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

Koa2 implementation question #70

Closed
ghost opened this issue Dec 2, 2016 · 6 comments
Closed

Koa2 implementation question #70

ghost opened this issue Dec 2, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 2, 2016

Any thoughts on how to handle Koa consumer after Koa2 released?

Chrome 55 released today and there is progress on a Node7 release that will ship with V8 5.5.
Node may land with official async/await support in less than a month.
Same for Koa2.

Would you ship a Koa2 version or replace existing one?
Thanks.

@simov
Copy link
Owner

simov commented Dec 3, 2016

Last time I checked Grant was working fine with Koa2. Check out my comment here.

I know that support for generators will be dropped in Koa3 so I think that would be a breaking change here as well. Using async/await functions for your Koa routes shouldn't be a problem, it's just that Grant is going to use a generator function for its routes.

I'm usually fairly quick to respond and apply a patch if needed so you just have to let me know if something isn't working.

@ghost
Copy link
Author

ghost commented Dec 3, 2016

mm, sorry, i'm not aware of any Koa3, did i miss something?

AFAIK, current version is v1 and it uses generators.
Next version is v2 and will be released (pretty soon) when Node will natively support async/await.
v2 does not allow generators middleware, everything should be async/await.

So when v2 released, will you support both versions or would async/await version replace generators one?

Thanks.

@simov
Copy link
Owner

simov commented Dec 3, 2016

Check out this section:

Old signature middleware (v1.x) support will be removed in v3

Koa v2.x will try to convert legacy signature, generator middleware on app.use, using koa-convert. It is however recommended that you choose to migrate all v1.x middleware as soon as possible.

From my prevous comment:

7a7e10c works for both Koa1.x and Koa2.x. For Koa2.x you have to update the koa-mount module to v2.x as well.

Again:

Grant currently works with both Koa1 and Koa2, however it won't work with Koa3 out of the box.

Let me know if something isn't working for you with Koa2.

@ghost
Copy link
Author

ghost commented Dec 3, 2016

thanks for patience :)
will give it another try and reply with results

@ghost
Copy link
Author

ghost commented Dec 3, 2016

works perfect!
was cooking it wrong.
thank you.

@simov
Copy link
Owner

simov commented Dec 3, 2016

No problem, thanks for the feedback!

@simov simov closed this as completed Dec 3, 2016
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