function isLoggedIn(req, res, next) {
    // if (req.isAuthenticated())
    //     return next();
    // res.redirect('/login');
    if (req.user) {
        next();
    } 
    else {
        res.redirect('/login');
    }
}
// Auth middleware that checks if the user is logged in
Auth middleware that checks if the user is logged in
Auth middleware that checks if the user is logged in
function isLoggedIn(req, res, next) {
    if (req.user) {
        next();
    } 
    else {
        res.redirect('/login');
    }
}
function isLoggedIn ( req , res , next ) { if ( req . user ) { next ( ) ; } else { res . redirect ( '/login' ) ; } }
Auth middleware that checks if the user is logged in
Auth middleware that checks if the user is logged in
// if (req.isAuthenticated()) //     return next(); // res.redirect('/login');