Skip to content

Commit 6b6b0dd

Browse files
authored
docs(api): add app.use chainability note (#1449)
1 parent 8ddab48 commit 6b6b0dd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/api/index.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,21 @@ https.createServer(app.callback()).listen(3001);
175175

176176
## app.use(function)
177177

178-
Add the given middleware function to this application. See [Middleware](https://github.com/koajs/koa/wiki#middleware) for
178+
Add the given middleware function to this application.
179+
`app.use()` returns `this`, so is chainable.
180+
```js
181+
app.use(someMiddleware)
182+
app.use(someOtherMiddleware)
183+
app.listen(3000)
184+
```
185+
Is the same as
186+
```js
187+
app.use(someMiddleware)
188+
.use(someOtherMiddleware)
189+
.listen(3000)
190+
```
191+
192+
See [Middleware](https://github.com/koajs/koa/wiki#middleware) for
179193
more information.
180194

181195
## app.keys=

0 commit comments

Comments
 (0)