app/api/routes/tag.js
function(req, res, next) {
    Tag.findOne({ name: req.params.name }, function(err, tag) {
      if (err) return next(err);
      if (!tag) return res.json(404, { error: 'failed to load tag ' + req.params.name });
      req.tag = tag;
      next();
    });
  }
function(req, res, next) {
    Tag.findOne({ name: req.params.name }, function(err, tag) {
      if (err) return next(err);
      if (!tag) return res.json(404, { error: 'failed to load tag ' + req.params.name });
      req.tag = tag;
      next();
    });
  }
function ( req , res , next ) { Tag . findOne ( { name : req . params . name } , function ( err , tag ) { if ( err ) return next ( err ) ; if ( ! tag ) return res . json ( 404 , { error : 'failed to load tag ' + req . params . name } ) ; req . tag = tag ; next ( ) ; } ) ; }
tag route middleware
tag route middleware