因为做过node,所以被问到koa中间件实现原理的问题,整理一下。 koa的执行顺序是这样的: const middleware = async function (ctx, next) { console.log(1); await next(); console.log(6); }; const middleware2 = async function (ctx, next) { console.log(2); await next(); console....
因为做过node,所以被问到koa中间件实现原理的问题,整理一下。 koa的执行顺序是这样的: const middleware = async function (ctx, next) { console.log(1); await next(); console.log(6); }; const middleware2 = async function (ctx, next) { console.log(2); await next(); console....