Skip to content

Commit b099fd0

Browse files
committed
docs: fix misleading middleware example path in routing docs (#4354)
1 parent 7765bcb commit b099fd0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

docs/1.docs/5.routing.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,16 @@ export default defineConfig({
271271
handlers: [
272272
{
273273
route: "/api/**",
274-
handler: "./server/middleware/api-auth.ts",
274+
handler: "./server/utils/api-auth.ts",
275275
middleware: true,
276276
},
277277
],
278278
});
279279
```
280280

281+
> [!WARNING]
282+
> When using `handlers` for route-scoped middleware, place handler files outside the `server/middleware/` directory. Files in `server/middleware/` run globally for all requests regardless of the `route` pattern.
283+
281284
Each handler entry supports the following options:
282285

283286
| Option | Type | Description |
@@ -408,7 +411,7 @@ export default defineConfig({
408411
handlers: [
409412
{
410413
route: "/api/**",
411-
handler: "./server/middleware/api-auth.ts",
414+
handler: "./server/utils/api-auth.ts",
412415
middleware: true,
413416
},
414417
],

0 commit comments

Comments
 (0)