app.use(function (req, res, next) {
res.locals.login = req.isAuthenticated();
app.locals.userinfo = req.user;
next();
});
i am using global variables to store user info as i need to display them in my main template. is it good practice to store user info in variables or is there a workaround? are there any performance issue in using variables?
i tried creating helpers but that doesnt seems to work.
passing value while rendering is also not possible as user info has to be displaye on nav bar that is part of my main template.
res.locals? The middleware you have right now looks fine but I would suggest to have the user object set tores.locals