docs: update middlewares to use defineMiddlewares (#8283)
This commit is contained in:
@@ -347,10 +347,10 @@ For example, suppose an administrator changes the product data in the ERP system
|
||||
Then, create the file `src/api/middlewares.ts` with the following content:
|
||||
|
||||
```ts title="src/api/middlewares.ts"
|
||||
import { MiddlewaresConfig } from "@medusajs/medusa"
|
||||
import { defineMiddlewares } from "@medusajs/medusa"
|
||||
import { raw } from "body-parser"
|
||||
|
||||
export const config: MiddlewaresConfig = {
|
||||
|
||||
export default defineMiddlewares({
|
||||
routes: [
|
||||
{
|
||||
method: ["POST", "PUT"],
|
||||
@@ -359,7 +359,7 @@ For example, suppose an administrator changes the product data in the ERP system
|
||||
middlewares: [raw({ type: "application/json" })],
|
||||
},
|
||||
],
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
This replaces the default JSON middleware with the raw middleware, which is useful for webhook routes.
|
||||
|
||||
Reference in New Issue
Block a user