I try to put my req.user
value in the global variable for all views with
app.use(function(req, res, next){
res.locals.user = req.user; // this line
res.locals.success = req.flash('success');
res.locals.error = req.flash('error');
next();
});
but nothing works. I have to put it on every render()
function. What did I do wrong?
Thank you for your help!