koa路由怎么用

https://img1.mukewang.com/5c35aa450001a89b06120304.jpg

https://img3.mukewang.com/5c35aa4d0001434c02900190.jpg

求教,为什么执行不到this.body这一步呢,路由写错了吗

凤凰求蛊
浏览 601回答 1
1回答

慕尼黑5688855

应该是koa-router吧我平常是这么用的var koa = require('koa');var koaRoute = require('koa-router');var views = require('koa-views');var app = new koa();var router = new koaRoute();router.get('/', async (ctx)=>{    await ctx.render('index')})app.use( views('./views/' , {    extension:'ejs'}) );app.use( router.routes() );app.listen(3000)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript