express/database/middleware.js
// middleware for mongo connection error for routes that need it
middleware for mongo connection error for routes that need it
middleware for mongo connection error for routes that need it
function mongoChecker (req, res, next) {
    if (mongoose.connection.readyState != 1) {
      log("Issue with mongoose connection");
      res.status(500).send("Internal server error");
      return;
    } else {
      next();
    }
  }
function mongoChecker ( req , res , next ) { if ( mongoose . connection . readyState != 1 ) { log ( "Issue with mongoose connection" ) ; res . status ( 500 ) . send ( "Internal server error" ) ; return ; } else { next ( ) ; } }
middleware for mongo connection error for routes that need it
middleware for mongo connection error for routes that need it
// check mongoose connection established.