docs: add context example
This commit is contained in:
parent
0ae852be03
commit
c132b83bc9
1 changed files with 12 additions and 3 deletions
|
@ -12,7 +12,16 @@
|
|||
which would force middlware to re-implement this common functionality.
|
||||
|
||||
A `Context` is created _per_ request, and is referenced in middleware
|
||||
as the receiver, or the `this` identifier.
|
||||
as the receiver, or the `this` identifier, as shown in the following
|
||||
snippet:
|
||||
|
||||
```js
|
||||
app.use(function *(){
|
||||
this; // is the Context
|
||||
this.request; // is a koa Request
|
||||
this.response; // is a koa Response
|
||||
});
|
||||
```
|
||||
|
||||
## Request aliases
|
||||
|
||||
|
|
Loading…
Reference in a new issue