环境
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
代码如上所示,然后访问 http://127.0.0.1:9901/logs/mobile/ios
成功获取了body的返回值,
但是this.params
为undefined