app.param('userId', (req, res, next) => {
// some actions
next()
})
app.get('/users/:userId', (req, res) => {
// some actions
res.end()
})
app.param('userId', (req, res, next) => {
// тут какой-то длинный код
next();
});
app.get('/users/:userId', (req, res) => { ... });
app.get('/users/:userId/info', (req, res) => { ... });
app.post('/users/:userId', (req, res) => { ... });