Code files
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const co = require('co')
|
||||
const router = require('koa-router')()
|
||||
|
||||
router.get('/', co.wrap(function *(ctx, next) {
|
||||
ctx.state = {
|
||||
title: 'Welcome to Koa'
|
||||
}
|
||||
yield ctx.render('index', {})
|
||||
}))
|
||||
|
||||
// router.get('/', async function (ctx, next) {
|
||||
// ctx.state = {
|
||||
// title: 'koa2 title'
|
||||
// }
|
||||
//
|
||||
// await ctx.render('index', {
|
||||
// })
|
||||
// })
|
||||
module.exports = router
|
||||
@@ -0,0 +1,7 @@
|
||||
const router = require('koa-router')()
|
||||
|
||||
router.get('/', function (ctx, next) {
|
||||
ctx.body = 'this a users response!'
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user