Home > Enterprise >  Options in res.render can only give 1 variable
Options in res.render can only give 1 variable

Time:12-22

I have a problem with the res.render in express who render a ejs view, if I try this :

res.render('index');

I don't have any problems, also if I do

res.render('index', {foo:"bar"});

I still don't have any problems but if I do

res.render('index', {foo:"bar", bar:"foo"});

all my vars will not be defined so someone have an idea how can fix this?

CodePudding user response:

try this:

res.render("index", { data: { foo: "bar", bar: "foo" } })
  • Related