6 ms·
Of course the code in my example handles promises. It's actually an example of koa code. Not sure why that is a "real risk". You generally want to be using pro
by always_good 10y ago
Of course the code in my example handles promises. It's actually an example of koa code.
Not sure why that is a "real risk". You generally want to be using promises with libraries that support them. That's why I wouldn't use promises in vanilla Express as my daily driver abstraction.
Compare this to callbacks where there's an actual real risk of silent error dropping any time you forget to `next(err)` or `.catch(handleErr)`, which is something you have to carry around for the life of the project instead of my example, where you choose a framework (once) that supports them.
I'd say it's a great demo and addressed all your concerns so far since it's this kind of context where async/await really pays off compared to the logFetch example.
- yamalight 10y agoFair enough! Looks like it might be a good time to move code from v4 (that had all those swallowing issues) to v7 and just forget about that. Promises sure came a long way :D
- tracker1 10y agoI really hope that this release means that koa2 will release soon.. been a little painful to determine which versions of what modules are supported. Really enjoying koa2 though.
- always_good 10y agoYou can keep track of the stable async/await-native koa release here: https://github.com/koajs/koa/issues/533 https://github.com/koajs/koa/issues/533 (scroll to the bottom). Looks like this is the release they've been waiting for.
- tracker1 10y agoyeah, now I'm having trouble getting webpack + hmr working with koa2 in node 7.6... the webpack page mentions issues with v7, so trying what I had in v6, will see if I can get it working.. :-(