app/api/routes/check.js
function(req, res, next) {
    Check
    .find({ _id: req.params.id })
    .select({qos: 0})
    .findOne(function(err, check) {
      if (err) return next(err);
      if (!check) return res.json(404, { error: 'failed to load check ' + req.params.id });
      req.check = check;
      next();
    });
  }
function(req, res, next) {
    Check
    .find({ _id: req.params.id })
    .select({qos: 0})
    .findOne(function(err, check) {
      if (err) return next(err);
      if (!check) return res.json(404, { error: 'failed to load check ' + req.params.id });
      req.check = check;
      next();
    });
  }
function ( req , res , next ) { Check . find ( { _id : req . params . id } ) . select ( { qos : 0 } ) . findOne ( function ( err , check ) { if ( err ) return next ( err ) ; if ( ! check ) return res . json ( 404 , { error : 'failed to load check ' + req . params . id } ) ; req . check = check ; next ( ) ; } ) ; }
check route middleware
check route middleware