1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| const router = require('koa-router')()
router.get('/', async (ctx, next) => { global.console.log('index11111'); await ctx.render('index', { title: 'Hello Koa 2!' }) })
router.get('/json', async (ctx, next) => { ctx.body = { title: 'koa2 json' } })
router.prefix('/users') module.exports = router
app.use(index.routes(), index.allowedMethods())
|