Another good alternative is Hapi: http://hapijs.com/
https://github.com/koajs/response-time/blob/master/index.js
The response time middleware records the start time, then yields to any other middleware, and finally sets the header.
You just can't do that as nicely in Express. Here is the Express version:
https://github.com/expressjs/response-time/blob/master/index...
responseTime has to wait to be called via "on-headers". on-headers is a separate module that monkey-patches response.writeHead.
The Koa version is 21 lines of code (really just 4 LOC), while the express version is over 200 LOC.