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:
Routes Code -
router.get('/', ensureAuthenticated, function(req, res){ res.render('administrator/dashboard',{title: 'Dashboard', user:req.user.username }); console.log(req.user.username); });
.ejs File Code -
Welcome: <%= user %>