From cf97a3909acb0a8abcfd0032d19ae37c49540879 Mon Sep 17 00:00:00 2001 From: zacanger Date: Thu, 23 Apr 2020 11:44:09 -0600 Subject: [PATCH] docs(api): add app.use chainability note --- docs/api/index.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/api/index.md b/docs/api/index.md index 7a91c0b77..c79064867 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -175,7 +175,21 @@ https.createServer(app.callback()).listen(3001); ## app.use(function) - Add the given middleware function to this application. See [Middleware](https://github.com/koajs/koa/wiki#middleware) for + Add the given middleware function to this application. + `app.use()` returns `this`, so is chainable. +```js +app.use(someMiddleware) +app.use(someOtherMiddleware) +app.listen(3000) +``` + Is the same as +```js +app.use(someMiddleware) + .use(someOtherMiddleware) + .listen(3000) +``` + + See [Middleware](https://github.com/koajs/koa/wiki#middleware) for more information. ## app.keys=