docs: fix import of defineMiddleware (#11293)
This commit is contained in:
@@ -27,7 +27,7 @@ Middlewares are defined in the special file `src/api/middlewares.ts`. Use the `d
|
||||
For example:
|
||||
|
||||
```ts title="src/api/middlewares.ts"
|
||||
import type {
|
||||
import {
|
||||
defineMiddlewares,
|
||||
MedusaNextFunction,
|
||||
MedusaRequest,
|
||||
@@ -118,7 +118,7 @@ For example:
|
||||
export const pathParamHighlights = [["11", ":id", "Indicates that the API route accepts an `id` path parameter."]]
|
||||
|
||||
```ts title="src/api/middlewares.ts" collapsibleLines="1-7" expandMoreLabel="Show Imports" highlights={pathParamHighlights}
|
||||
import type {
|
||||
import {
|
||||
MedusaNextFunction,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
@@ -150,7 +150,7 @@ For example:
|
||||
export const highlights = [["12", "method", "Apply the middleware only on `POST` requests"]]
|
||||
|
||||
```ts title="src/api/middlewares.ts" highlights={highlights} collapsibleLines="1-7" expandButtonLabel="Show Imports"
|
||||
import type {
|
||||
import {
|
||||
MedusaNextFunction,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
@@ -183,7 +183,7 @@ A middleware whose `matcher` pattern doesn't end with a backslash won't be appli
|
||||
For example, consider you have the following middleware:
|
||||
|
||||
```ts collapsibleLines="1-7" expandMoreLabel="Show Imports"
|
||||
import type {
|
||||
import {
|
||||
MedusaNextFunction,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
@@ -214,4 +214,4 @@ 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.
|
||||
In general, avoid adding trailing backslashes when sending requests to API routes.
|
||||
|
||||
Reference in New Issue
Block a user