0
我有一個POST處理程序:Express 3.x req.params是帶方括號的對象嗎?
app.use(express.bodyParser());
app.use(app.router)
app.post('/api/auth/:service', function(req, res) {
console.log('req.params', req.params);
...
當我打印req.params我得到一個奇怪的現象:
req.params [ service: 'webui' ]
它看起來像一個對象,但它有方括號。
什麼是req.params
?
根據http://expressjs.com/3x/api.html#req.params:
This property is an array containing properties mapped to the named route
"parameters".