摘要: const router = require('koa-router')() //返回一个页面 router.get('/', async (ctx, next) => { global.console.log('index11111'); await ctx.render('index', { //render返回一个页面 title: 'Hello Koa 2!' ... 阅读全文
posted @ 2019-04-14 03:59 空瓶子装满了 阅读(269) 评论(0) 推荐(0) 编辑
摘要: function pv(ctx){ global.console.log(ctx.path); } module.exports=function(){ return async function(ctx,next){ pv(ctx); await next(); //next是继续执行下面的中间件,如果不写会直接跳出,不会继续执行 } ... 阅读全文
posted @ 2019-04-14 03:41 空瓶子装满了 阅读(155) 评论(0) 推荐(0) 编辑