This release of the Koa framework is short but sweet. If anything this is an indication that our design choices with 0.1.0 were pretty solid, we haven’t come across any road blocks yet in terms of design, so from now on it should be mostly polish, which means if you’d like to start building real projects with Koa you should be safe!
Socket error handling
Koa now handles socket errors for you and relays them to the app’s “error” event for centralized reporting. This is something that you typically have to do yourself with node applications, and if you forget it’s extremely easy to bring down the entire process, but now you won’t have to worry about it!
Jonathan has been working on refactoring some of the shared functionality between Express & Koa into reusable modules. So far we’ve got accepts for content-negotiation, and type-is for request Content-Type assertions.
Refined ctx.throw() signature
This is a tiny change, but previously ctx.throw() accepted ctx.throw(message[, status]) — now you may pass the status first, matching APIs from Express that you may be more used to such as res.send(status, body).
This update is actually to the koa-compose module, an integral component which composes an array of middleware, and is used in core for app.use().
With the use of the debug module you can enable instrumentation of specified modules — in this case when you use DEBUG=koa-compose the request state is written to stdout before and after each middleware. The number on the left indicates the depth, followed by the middleware name, this makes it very easy to determine which middleware has manipulated the response.
That’s all for now, if you’ve played around with Koa and have suggestions let us know!