koa2 的洋葱圈
class Template_C{
static a= async(ctx,next) => {
console.log("a1")
await next()
console.log("a2")
}
static b= async(ctx,next) => {
console.log("b1")
await next()
console.log("b2")
}
static c= async(ctx,next) => {
console.log("c1")
await next()
console.log("c2")
}
}
export default Template_C;
//serve.js
serve.use(async (ctx,next) => {
console.log("serve1")
await next()
console.log("serve2")
})
//输出:
// a1
// b1
// c1
// serve1
// serve2
// c2
// b2
// a2