saadq/koa-combine-routers

Doesn't return a generator function?

moiz-frost opened this issue · 4 comments

AssertionError: app.use() requires a generator function

Any idea why? Its already a generator function.

saadq commented

Hmm, could you share a minimal repo where you face this issue? I can check it out.

saadq commented

Hmm, it doesn't look like you're using koa-combine-routers here, you're just using its implementation details in your combinedRoutes.js. There are a few things that could be causing this issue, I'm guessing it probably has to do with using a version of koa-compose that is meant for Koa v2 instead of Koa v1 which is what you're using.

If you try switching your code to use koa-combine-routers and you still face issues, let me know and feel free to reopen this.

Thanks, that seems to do the trick. I'm also wondering why do I have to not call the imported routes instead of just passing them in app.use()?

Line 24