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
Add support for ES6 Generator Functions in release 5.0 #2506
Comments
As long as it works in Node.js 0.10 out of the box, then certainly possible. |
Looking at your commit, though, clearly Express 4 already supports generators: just pass the result of co.wrap to Express. |
I think using wrap-fn would be a better implementation. Also supports promises and sync functions. |
Also +1 to @dougwilson's observation. |
I do want to eventually natively support Promises in Express handlers, which really supersedes this; co was only meant to be a stop-gap to abuse generators and provide a trampoline. I hear JS is closer to getting the await keyword, which works with Promises and makes co obsolete. |
That is correct @dougwilson, using co was just for a POC. I'm glad to hear that might be Promises would be natively supported at some point. What I would really want is to see support for |
That is promise support. As soon as we support Promises you would have await for free. So it's basically on the roadmap. |
Awesome thanks @dougwilson |
Initial promise support landed in Express.js 5.0.0-alpha.7 I think this issue can be closed |
I agree we should close this. We have promise support being worked on, and if we ever want to pick up more advanced usage of generator functions in the future we can open a new issue with a more detailed proposal. |
Yea, this is an old one. The generator stuff was a stand in before async keyword (based on promises) anyway, so I don't think it's even relevant in the general sense any more. |
Yes, this is no longer an issue. Thanks 👍 |
Hey Everyone,
Over the week I forked express and added generator function support for middleware and request handlers. It was only a few lines of code, here is the commit, and I recorded my results in this blog post.
Would it be possible to add support in the next release of Express.
The text was updated successfully, but these errors were encountered: