routes/gameRoutes.js
/*
 * Check if the user has authenticated
 * @param req, res - as always...
 * @param {function} next - The next middleware to call.  This is a standard
 *    pattern for middleware; it should call the next() middleware component
 *    once it has completed its work.  Typically, the middleware you have
 *    been defining has made a response and has not needed any additional 
 *    middleware.
 */
Check if the user has authenticated
@param req, res - as always
@param {function} next - The next middleware to call.  This is a standard
pattern for middleware; it should call the next() middleware component
once it has completed its work.  Typically, the middleware you have
been defining has made a response and has not needed any additional
middleware.
Check if the user has authenticated @param req res - as always @param { function } next - The next middleware to call . This is a standard pattern for middleware ; it should call the next () middleware component once it has completed its work . Typically the middleware you have been defining has made a response and has not needed any additional middleware .
function checkAuthentication(req, res, next){
    console.log("authentication checking");
    if(req.isAuthenticated()){
      console.log("authentication checked");
        next();
    }else{
        console.log("authentication denied");
        res.redirect("/index");
    }
}
function checkAuthentication ( req , res , next ) { console . log ( "authentication checking" ) ; if ( req . isAuthenticated ( ) ) { console . log ( "authentication checked" ) ; next ( ) ; } else { console . log ( "authentication denied" ) ; res . redirect ( "/index" ) ; } }
Check if the user has authenticated
 @param req, res - as always...
 @param {function} next - The next middleware to call.
Check if the user has authenticated @param req res - as always ... @param { function } next - The next middleware to call .
// Passport will set req.isAuthenticated // call the next bit of middleware //    (as defined above this means doMembersOnly) // The user is not logged in. Redirect to the login page.