i5ting / koa-generator

Koa' application generator for 1.x and 2.x( Express-style and support all middlewares include async/await )
https://github.com/17koa/koa-generator
MIT License
972 stars 110 forks source link

app中使用koa-router方法无效? #57

Open AbeDai opened 5 years ago

AbeDai commented 5 years ago

version: 1.1.16

通过koa2 project_name创建项目后,在app.js中,出现了app.use(router.routes(), router.allowedMethods());

app.use()不是只接受第一个参数的吗?

wangminghuan commented 3 years ago

同问,查阅源码也发现use只支持一个参数,不知道此处是依据哪个版本的api。我改成了这样:app.use(router.routes()).use(router.allowedMethods())