app.get('/',function(req,res){
res.render('home'); // I want the template to be able to access the flash message..
});
app.get('/go',function(req,res){
req.flash("info", "You went GO, and got redirected to home!");
res.redirect('/');
});
The user first goes to “/go”. After that, he will be redirected to “/” and I want a flash message to show as a javascript alert.
How can I do that?
Add it as a local to your call to render:
And use it in your template: