koajs/koa — pull request #366 by MatthewMueller (2014-11-18 00:36:52+00:00)
Title: add: ctx.locals as a recommended namespace for passing information to the frontend

Just throwing this PR out there. It was discussed in: https://github.com/koajs/koa/issues/338.

Basically this gives you a namespace to attach to that you don't have to worry about being undefined. Alternatively, we you could add:

```
app.use(function *() {
this.locals = this.locals || {};
});
```

at the top of your stack. I feel like this is common enough use-case that it should be added to core, but open to your thoughts.