Koa is an evolution of the middleware concept in line with updates to the JavaScript language. Originally in Koa-v1, flow control was handled by re-purposing ECMAScript 2015 (ES6) Generator functions (using the yield keyword to freeze function execution) combined with promises. In Koa-v2, a more normative route is taken using ES 2016 async/await syntax.
It's a minimalist web framework compared to Express (and far more minimalist compared to Hapi). Koa is more closely comparable to the Connect web framework (which was the precursor to Express). This means that functionality that tends to come as standard in other web frameworks (such as route handling) is installed separately as Koa middleware.
In this recipe, we're going to create a Koa (v2) web application.
This recipe focuses on Koa-v2, using up-to-date async/await syntax, which is...