Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xyx650 opened this issue Feb 2, 2021 · 0 comments
Open

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

xyx650 opened this issue Feb 2, 2021 · 0 comments

Comments

@xyx650
Copy link

xyx650 commented Feb 2, 2021

使用最新的 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 之前执行?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant