app/routes.js
// route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
function isLoggedIn(req, res, next) {
    if (req.isAuthenticated())
        return next();
    res.redirect('/?next='+req.url);
}
function isLoggedIn ( req , res , next ) { if ( req . isAuthenticated ( ) ) return next ( ) ; res . redirect ( '/?next=' + req . url ) ; }
route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
// if user is authenticated in the session, carry on // if they aren't redirect them to the home page