我想修改中间件中的路由参数:
express = require 'express'
bodyParser = require 'body-parser'
app = express()
app.use(bodyParser.json())
// app.param(...) is deprecated
app.use (req, res, next) ->
console.log req.params.id // undefined
// req.param() is deprecated
next()
app.get '/test/:id', (req, res, next) ->
console.log(req.params.id) // correct
res.json({ id: req.params.id })
我如何在中间件中做到这一点?在中间件执行期间似乎尚未解析参数...