Using Passport.js and Express for several projects, I noticed that I was doing it again and again, namely, explicitly specifying { user: req.user } for my Express routes. Ocassionally I forgot to transfer it, and suddenly he, as a user, did not even log in anymore.
How to pass user variable in my routes without explicitly writing it for each route, like this?
app.get = function(req, res, next) { res.render('home', { title: 'Home', user: req.user }); };
I think everyauth has such an express helper, but does Passport.js?
Sahat yalkabov
source share