Raw
1 import {
2 defineMiddlewares,
3 validateAndTransformBody,
4 } from "@medusajs/framework/http"
5 import { z } from "@medusajs/framework/zod"
6
7 const CustomPostSchema = z.object({
8 foo: z.string(),
9 })
10
11 export default defineMiddlewares({
12 routes: [
13 {
14 method: ["POST"],
15 matcher: "/custom",
16 middlewares: [validateAndTransformBody(CustomPostSchema)],
17 },
18 ],
19 })