Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ctx.state.user = await User.find(id);

### ctx.app.emit

Koa applications extend an internal [EventEmitter](https://nodejs.org/dist/latest-v11.x/docs/api/events.html). `ctx.app.emit` emits an event with a type, defined by the first argument. For each event you can hook up "listeners", which is a function that is called when the event is emitted. Consult the [error handling docs](https://koajs.com/#error-handling) for more information.
Koa applications extend an internal [EventEmitter](https://nodejs.org/docs/latest/api/events.html). `ctx.app.emit` emits an event with a type, defined by the first argument. For each event you can hook up "listeners", which is a function that is called when the event is emitted. Consult the [error handling docs](https://koajs.com/#error-handling) for more information.

### ctx.cookies.get(name, [options])

Expand Down
11 changes: 6 additions & 5 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ app.listen(3000);
- `app.env` defaulting to the __NODE_ENV__ or "development"
- `app.keys` array of signed cookie keys
- `app.proxy` when true proxy header fields will be trusted
- `app.subdomainOffset` offset of `.subdomains` to ignore, default to 2
- `app.proxyIpHeader` proxy ip header, default to `X-Forwarded-For`
- `app.maxIpsCount` max ips read from proxy ip header, default to 0 (means infinity)
- `app.asyncLocalStorage<Boolean|asyncLocalStorage>` - pass `true` or an instance of `AsyncLocalStorage` to enable async local storage. See below for details.
- `app.subdomainOffset` offset of `.subdomains` to ignore, defaults to 2
- `app.proxyIpHeader` proxy ip header, defaults to `X-Forwarded-For`
- `app.maxIpsCount` max ips read from proxy ip header, defaults to 0 (means infinity)
- `app.compose` - function to handle middleware composition
- `app.asyncLocalStorage` pass `true` or an instance of `AsyncLocalStorage` to enable async local storage. See below for details.

You can pass the settings to the constructor:
```js
Expand Down Expand Up @@ -232,7 +233,7 @@ function callSomeFunction () {
}
```

Starting in v3.1.0, you can also pass your own AsyncLocalStorage instance:
Starting in v3.1.0, you can also pass your own `AsyncLocalStorage` instance:

```js
const asyncLocalStorage = new AsyncLocalStorage()
Expand Down
12 changes: 6 additions & 6 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ module.exports = class Application extends Emitter {
/**
*
* @param {object} [options] Application options
* @param {string} [options.env='development'] Environment
* @param {string} [options.env='development'] Environment. Defaults to `NODE_ENV` or `'development'`.
* @param {string[]} [options.keys] Signed cookie keys
* @param {boolean} [options.proxy] Trust proxy headers
* @param {number} [options.subdomainOffset] Subdomain offset
* @param {string} [options.proxyIpHeader] Proxy IP header, defaults to X-Forwarded-For
* @param {number} [options.maxIpsCount] Max IPs read from proxy IP header, default to 0 (means infinity)
* @param {boolean} [options.proxy] When `true`, proxy header fields will be trusted.
* @param {number} [options.subdomainOffset] Subdomain offset, defaults to `2`
* @param {string} [options.proxyIpHeader] Proxy IP header, defaults to `X-Forwarded-For`
* @param {number} [options.maxIpsCount] Max IPs read from proxy IP header, defaults to `0` (means infinity)
* @param {function} [options.compose] Function to handle middleware composition
* @param {boolean} [options.asyncLocalStorage] Enable AsyncLocalStorage, default to false
* @param {boolean|AsyncLocalStorage} [options.asyncLocalStorage] Pass `true` or an instance of `AsyncLocalStorage` to enable async local storage.
*
*/

Expand Down
Loading