So i am setting my flash messages inside my controller method like this:req.flash('info', 'flash is working')
and then i console.log(req.flash())
in the controller to see if it works. Then in my app.js file i simply pass it on to a res.locals so that it is available to me in my templates but there i was receiving an empty object so i did console inside the middleware to assign res.locals and it was empty there as well. Why is this happening ?
app.use((req, res, next) => {
res.locals.flashes = req.flash();
res.locals.h = helpers;
console.log(req.flash());
next();
});
btw i know the first request is supposed to return empty flash object but the second one returns empty as well