From 241c3bb19b5d450d48f286d90fee95e55d55da09 Mon Sep 17 00:00:00 2001 From: kushal4345 <155578739+kushal4345@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:46:53 +0530 Subject: [PATCH] docs: add note about path matching behavior (#1941) --- _includes/api/en/5x/app-use.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/_includes/api/en/5x/app-use.md b/_includes/api/en/5x/app-use.md index 8b5a2b13cc..5329088907 100644 --- a/_includes/api/en/5x/app-use.md +++ b/_includes/api/en/5x/app-use.md @@ -139,6 +139,22 @@ app.use(['/abcd', '/xyza', /\/lmn|\/pqr/], (req, res, next) => { +> **Note:** The above path examples describe how `app.use()` matches paths. +> When using route methods (such as `app.get()`, `app.post()`, etc.), the path must match exactly. +> For example: +> +> ```js +> app.use('/api', (req, res, next) => { +> // Matches /api, /api/users, /api/orders/123 +> next() +> }) +> +> app.get('/api', (req, res) => { +> // Only matches /api +> res.send('Hello API') +> }) +> ``` + #### Middleware callback function examples The following table provides some simple examples of middleware functions that