user_route.js 223 B

1234567891011
  1. app.param('user_id', function(req, res, next, user_id) {
  2. UserDatabase.find(user_id, function(err, user) {
  3. if (err) return next(err);
  4. if (!user) return next(
  5. );
  6. req.user = user;
  7. next()
  8. });
  9. });