koa-generator icon indicating copy to clipboard operation
koa-generator copied to clipboard

app.js 文件中关于路由的 use 问题

Open xyx650 opened this issue 3 years ago • 0 comments

使用最新的 koa-generator 生成的项目 app.js 文件中,有如下一段代码:

// routes app.use(index.routes(), index.allowedMethods()) app.use(users.routes(), users.allowedMethods())

IDE 提示 Invalid number of arguments, expected 1 查看了相关文档和 koa 源码,其中 app.use 只接收一个参数 fn。 index.allowedMethods() 等操作是否可以放在 routers 的相关文件中,在 module.exports 之前执行?

xyx650 avatar Feb 02 '21 03:02 xyx650