Closed xfoxfu closed 7 years ago
I think it is better to offer a option of passing through the returning value of the next middleware, as most applications may wrap a global error handler before all the middlewares. By providing such feature, we can do:
koa.use(async (ctx,next) => { console.log("middleware returned",await next()); }); koa.use(bodyParser());
Which adds a lot flexibility to applications.
you can read request body from ctx.request.body
ctx.request.body
I think it is better to offer a option of passing through the returning value of the next middleware, as most applications may wrap a global error handler before all the middlewares. By providing such feature, we can do:
Which adds a lot flexibility to applications.