router.routes is not a function
apiA.js
module.exports = (ctx) =>{
ctx.body = {
name: 'apia',
passworld:123
}
}
aRouter.js
const Router = require('koa-router')
const aRouter = require('../api/apiA')
const router = new Router()
router.get('/apiA',aRouter)
module.exports = router
router.js
const combineRouter = require('koa-combine-routers')
const a = require('./aRouter')
const b = require('./bRouter')
module.exports = combineRouter({
a,
b
})
index.js
const Koa = require('koa')
const router = require('./router/router')
const app = new Koa()
app.use(router())
app.listen(5200)
46
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星