You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, when :user is present in a route path, you may map user loading logic to automatically provide req.user to the route, or perform validations on the parameter input.
router.param('user', function(req, res, next, id) {
// try to get the user details from the User model and attach it to the request objectUser.find(id, function(err, user) {if (err) {next(err);} else if (user) {req.user = user;next();} else {next(new Error('failed to load user'));}});});