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
// apply the routes to our applicationapp.use('/', router);
Route Middleware for Parameters
// server.js
...
// we'll create our routes here
// get an instance of routervar router = express.Router();
...
// route middleware to validate :namerouter.param('name', function(req, res, next, name) {// do validation on name here// blah blah validation// log something so we know its workingconsole.log('doing name validations on ' + name);
`// once validation is done save the new item in the req`
`req.name = name;`
`// go to the next thing`
`next(); `