In node, we have a lot of callback-based functions. In node 0.11, theres a big push for ES6, which introduces a bunch of cool things to javascript, one of which is generators. Koa is a new web framework from the creators of express which uses the new generators as middleware. All the new generator stuff is great and you should really read more into it. It brings a level of concurrency that Go and python’s gevent (and others unmentioned) have to node and other javascript platforms.

Eventually, though, you’ll come across converting a callback-based function into a ES6 generator. This is pretty simple to fix though, we just need to create a promise which can be yielded to!