From 6b3086503834bc8d6a40a13049bc1d3e8b0a1331 Mon Sep 17 00:00:00 2001 From: Sinewyk Date: Tue, 21 Apr 2020 23:01:41 +0200 Subject: [PATCH] doc: be more precise about the behavior of middleware on the router fix: https://github.com/koajs/router/issues/44 --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 05828e1..868e8b0 100644 --- a/API.md +++ b/API.md @@ -182,7 +182,7 @@ Returns router middleware which dispatches a route matching the request. #### router.use([path], middleware) ⇒ Router -Use given middleware. +Use given middleware, __if and only if__, a route is matched. Context: [bug report](https://github.com/ZijianHe/koa-router/issues/182) & [test](https://github.com/koajs/router/blob/2e69eca36739171ee23dde9f616a133488378a62/test/lib/router.js#L197-L222) Middleware run in the order they are defined by `.use()`. They are invoked sequentially, requests start at the first middleware and work their way