I am working on a blogging application (click the link to see the GitHub repo) with Express, EJS and MongoDB.
Before submitting a
use this code in index.js to get flash error messages locally in EJS ,
app.use(function (req, res, next) { res.locals.messages = req.flash(); next(); });