const Koa = require( 'koa' );
const app = new Koa();
// Our most outer middleware, sending response to the user.
app.use( async ( context, next ) => {
await next(); // Passing control to the inner middleware.
context.body = 'Hello World!';
} );
// Our most inner middleware, logging out request.
app.use( async ( { request } ) => {
console.log( 'Got request', request );
} );
app.listen( 3000 );