Declared Passport helper middleware so you don't have to explicitly pass user: req.user explicitly to templates

This commit is contained in:
Sahat Yalkabov
2014-01-03 18:19:11 -05:00
parent 85320d216b
commit f660cd5129
5 changed files with 12 additions and 23 deletions

4
app.js
View File

@@ -47,6 +47,10 @@ app.use(express.methodOverride());
app.use(express.session({ secret: '0000' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(function(req, res, next) {
res.locals.user = req.user;
next();
});
app.use(flash());
app.use(less({ src: __dirname + '/public', compress: true }));
app.use(app.router);