docs: add section on middleware registration (#11433)
This commit is contained in:
@@ -215,3 +215,11 @@ If you send a request to `http://localhost:9000/custom`, the middleware will run
|
||||
However, if you send a request to `http://localhost:9000/custom/`, the middleware won't run.
|
||||
|
||||
In general, avoid adding trailing backslashes when sending requests to API routes.
|
||||
|
||||
---
|
||||
|
||||
## Middlewares Precedence in Registration
|
||||
|
||||
The Medusa application registers your middlewares first, then registers middlewares defined in Medusa's core.
|
||||
|
||||
So, if you add a middleware for a route defined in the core, it might get overridden by the core middleware. For example, if you add a middleware to change authentication of admin wrotes, the authentication middleware defined in the core will still run, leading to your middleware not being effective.
|
||||
|
||||
@@ -53,7 +53,7 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/admin/tips/page.mdx": "2025-02-05T09:07:52.584Z",
|
||||
"app/learn/fundamentals/api-routes/cors/page.mdx": "2024-12-09T13:04:04.357Z",
|
||||
"app/learn/fundamentals/admin/ui-routes/page.mdx": "2024-12-09T16:44:40.198Z",
|
||||
"app/learn/fundamentals/api-routes/middlewares/page.mdx": "2024-12-09T13:04:03.712Z",
|
||||
"app/learn/fundamentals/api-routes/middlewares/page.mdx": "2025-02-12T17:05:20.708Z",
|
||||
"app/learn/fundamentals/modules/isolation/page.mdx": "2024-12-09T11:02:38.087Z",
|
||||
"app/learn/fundamentals/data-models/configure-properties/page.mdx": "2024-10-21T13:30:21.368Z",
|
||||
"app/learn/fundamentals/data-models/index/page.mdx": "2024-10-21T13:30:21.368Z",
|
||||
|
||||
+9218
-9210
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user