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:
res.render("home", {info: req.flash("info")});
And use it in your template:
#flash
p= info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With