From 2b49fe93ff67e8444a95ed60f8f9c507332cfada Mon Sep 17 00:00:00 2001 From: Hiago Lucas Cardeal de Melo Silva Date: Fri, 1 Nov 2024 14:45:03 -0300 Subject: [PATCH] add cors middleware --- node/middlewares/cors.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 node/middlewares/cors.ts diff --git a/node/middlewares/cors.ts b/node/middlewares/cors.ts new file mode 100644 index 0000000..166deba --- /dev/null +++ b/node/middlewares/cors.ts @@ -0,0 +1,8 @@ +export async function cors(ctx: Context, next: () => Promise) { + ctx.status = 200 + ctx.set('Access-Control-Allow-Origin', 'storecomponents.myvtex.com/') + ctx.set('Access-Control-Allow-Methods', '*') + ctx.set('Access-Control-Allow-Headers', '*') + + await next() +}