Why do I have to call 'return' on ctx.render
rkt2spc opened this issue · 1 comments
rkt2spc commented
Why does this works:
app.use((ctx, next) => {
return ctx.render('user', { user }); // return is important, I don't know why
});
and this doesn't:
app.use((ctx, next) => {
ctx.render('user', { user }); // Response 404
});
int64ago commented
https://github.com/koajs/koa/blob/master/lib/application.js#L113
https://github.com/koajs/koa/blob/master/lib/application.js#L126
https://github.com/koajs/compose/blob/master/index.js#L42
The callback in use
should be in synchronous (like async/await
) or return a Promise