Code files
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
const router = require('koa-router')()
|
||||
|
||||
router.get('/', async function (ctx, next) {
|
||||
await next()
|
||||
await ctx.render('index')
|
||||
}, async (ctx) => ctx.state = {title: 'Koa'})
|
||||
|
||||
|
||||
// simplified:
|
||||
// router.get('/', async (ctx, next) => {
|
||||
// await ctx.render('index', {title: 'Koa'})
|
||||
// })
|
||||
|
||||
module.exports = router
|
||||
|
||||
Reference in New Issue
Block a user