index.ts 462 B

1234567891011121314151617
  1. import cors from "cors"
  2. import { Router } from "express"
  3. import bodyParser from "body-parser"
  4. import customRouteHandler from "./custom-route-handler"
  5. import { wrapHandler } from "@medusajs/medusa";
  6. const storeRouter = Router()
  7. export function getStoreRouter(storeCorsOptions): Router {
  8. storeRouter.use(cors(storeCorsOptions), bodyParser.json())
  9. storeRouter.post(
  10. "/store/my-custom-path",
  11. wrapHandler(customRouteHandler)
  12. )
  13. return storeRouter
  14. }