javascript - In Express.js, how do I make my template display the flash messages? -
app.get('/',function(req,res){ res.render('home'); // want template able access flash message.. }); app.get('/go',function(req,res){ req.flash("info", "you went go, , got redirected home!"); res.redirect('/'); });
the user first goes "/go". after that, redirected "/" , want flash message show javascript alert.
how can that?
add local call render:
res.render("home", {info: req.flash("info")});
and use in template:
#flash p= info
Comments
Post a Comment