亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

koa-router cannot get path parameters - Stack Overflow
天蓬老師
天蓬老師 2017-06-15 09:22:49
0
1
727

Environment
Node 8.0.0
koa 2.2.0
koa-router 7.1.1

const router = require('koa-router')()

router.prefix('/logs/mobile')

router.get('/:platform', function(cxt, next) {
    console.log('params', this.params);
    cxt.body = { error: 'test'}
})

module.exports = router

The code is as shown above, and then access http://127.0.0.1:9901/logs/mobile/ios and successfully obtain the return value of the body,
but this.paramsisundefined

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見證您的進(jìn)步~~

reply all(1)
我想大聲告訴你

You need to use ctx.params

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template