You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
351 B
20 lines
351 B
2 years ago
|
const router = require('koa-router')()
|
||
|
|
||
|
router.get('/', async (ctx, next) => {
|
||
|
await ctx.render('index', {
|
||
|
title: 'Hello Koa 2!'
|
||
|
})
|
||
|
})
|
||
|
|
||
|
router.get('/string', async (ctx, next) => {
|
||
|
ctx.body = 'koa2 string'
|
||
|
})
|
||
|
|
||
|
router.get('/json', async (ctx, next) => {
|
||
|
ctx.body = {
|
||
|
title: 'koa2 json'
|
||
|
}
|
||
|
})
|
||
|
|
||
|
module.exports = router
|