Closed darthtrevino closed 9 years ago
Let's add a 'parameteResolvers' config section that invokes app.param() http://expressjs.com/4x/api.html#app.param
{ parameterResolvers: [{ parameter: "id", resolver: (req, res, next, id) => User.findById(id).then((found) => { res.foundUser = found; next(); }); }], routes: { getUser: { method: 'GET' path: "/:id", middleware: [ // asssume req.foundUser is populated ] } } }
Let's add a 'parameteResolvers' config section that invokes app.param() http://expressjs.com/4x/api.html#app.param