koajs/koa — pull request #266 by zeekay (2014-04-25 18:58:51+00:00)
Title: Allow non-generator functions as middleware.

This change makes it possible to call `app.use` with a normal function. Any normal function used as a middleware will be wrapped in a generator which will properly yield to the next generator in the middleware stack. This makes the common use case of setting `this.body` simpler and less error prone. Obligatory hello world example becomes:

```javascript
var app = require('koa');

app.use(function (){
this.body = 'Hello World';
});
```
I think this is preferable to the current syntactic shortcut of writing a non-yielding generator, which would stop any downstream middleware from being able to process the response (or doing any other sort of work).

Tests have been updated appropriately.