function pv(ctx){
    global.console.log(ctx.path);
}
module.exports=function(){
  return async function(ctx,next){
        pv(ctx);
        await next();    //next是继续执行下面的中间件,如果不写会直接跳出,不会继续执行
  }  
}
//app.js
const pv = require('./middleware/koa-pv');
app.use(pv())

 

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2021-07-14
  • 2021-03-30
  • 2022-12-23
猜你喜欢
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
相关资源
相似解决方案