Saturday 19 March 2016

koa vs. Hapi+co vs. Hapi+async/await

At the moment, I've been working on a project where I use Hapi. Most API calls are handled with promises, but some of them require a bit more work and instead of using .then four times, I prefer to use co to add a generator function as the handler, so I can use yield everytime to perform all operations.Now it isn't exactly clear to me how co differs from using async/await, is it just that async/await is a native function of ES7, or is there a functional difference?And if I use Hapi this way, what advantages does koa have, aside from being a bit more easy to read? I understood that koa uses co to treat every route as a generator function, but does this result in a functional difference from using any other web framework with co? (aside from looking a bit cleaner)

Submitted March 19, 2016 at 05:08PM by itsYourDeveloper

No comments:

Post a Comment