- middleware/koa-pv.js
const pv = ctx => {
console.log("path:" + ctx.path);
};
module.exports = () => async (ctx, next) => {
pv(ctx);
await next();
};
- app.js
const Koa = require("koa");
const pv = require("./middleware/koa-pv");
app.use(pv());
网友评论