In nodeJS I am using the passport module for authentication. I would like to show the username of the currently logged in user.
I tried the following code:
Helpers are not supported with Express v4.x
A good alternative is to create a middleware such as:
app.use((req, res, next) => { res.locals.user = req.user; next(); });
Then you can use the "user" variable in your views.