Koa 2を使用した簡単な例はありますか?
const n = next({ dev })
const handle = n.getRequestHandler()
n.prepare()
.then(() => {
const app = new Koa()
const router = new Router()
router.get('*', async ctx => {
await handle(ctx.req, ctx.res)
ctx.respond = false
})
app.use(async (ctx, next) => {
// Koa doesn't seems to set the default statusCode.
// So, this middleware does that
ctx.res.statusCode = 200
await next()
})
app.use(router.routes())
app.listen(3000)
})
@timneutkensノードにasync/awaitが追加されたため、Koa2.0.1は3日前にリリースされました😄このバージョンを使用するように例を更新するのは理にかなっていると思います。
確かに、新しいチケットを作成します。
最も参考になるコメント