From 5f4574b8f5e25bee56899e8e594e4e86916eac10 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sun, 18 Aug 2013 11:18:05 -0700 Subject: [PATCH] add app.context() docs --- docs/api.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/api.md b/docs/api.md index 474beec..57b34fb 100644 --- a/docs/api.md +++ b/docs/api.md @@ -59,6 +59,28 @@ http.createServer(app.callback()).listen(3001); Add the given middleware function to this application. See [Middleware](#middleware) for more information. +### app.context(obj) + + Each `Application` has its own `Context` instance, meaning you may extend the prototype of one, + and the other will remain untouched with the default prototype. To extend an apps context you may + invoke `app.context()` any number of times with an object of extensions: + +```js +app.context({ + get something(){ + return 'hi'; + }, + + set something(val){ + this._something = val; + }, + + render: function(){ + this.body = ''; + } +}); +``` + ## Context A Koa Context encapsulates node's `request` and `response` objects