const koa = require("koa");
const app = new koa();
app.use(async(ctx, next) => {
console.log(1);
await next();
console.log(2);
ctx.body = "Hello zhihu aa";
})
app.use(async(ctx, next) => {
console.log(3);
await next();
console.log(4);
ctx.body = "Hello zhihu aa";
})
app.use(async(ctx) => {
console.log(5);
ctx.body = "test";
})
app.listen(3000, function() {
console.log("请访问127.0.0.1:3000");
});
请求顺序是: