Created
October 21, 2016 10:35
-
-
Save somat/2b84148145c7143681f8e7071b1bfbd4 to your computer and use it in GitHub Desktop.
Auth middleware, set layout for authenticated user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isAuth = function(req, res, next) { | |
if(req.user) { | |
res.locals.layout = 'app'; | |
next(); | |
} else { | |
res.redirect(res.locals.url.login); | |
} | |
} | |
module.exports = isAuth; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment