From 686f29b53957a79c9b8f703cbcb3a47bc30cbe56 Mon Sep 17 00:00:00 2001 From: LBlend Date: Fri, 6 Aug 2021 12:18:58 +0200 Subject: [PATCH] apply CORS globally --- webhook-api/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/webhook-api/index.js b/webhook-api/index.js index c288a77..5803b00 100644 --- a/webhook-api/index.js +++ b/webhook-api/index.js @@ -7,15 +7,13 @@ const app = express() const frontendURL = process.env.FRONTEND_URL || "https://uiogaming.no" const port = process.env.PORT || 9001 -app.use(express.json()) - -const corsOptions = cors({ origin: frontendURL }) +app.use(cors({ origin: frontendURL })) app.get("/", (req, res) => { res.send("API is running! Yeet!") }) -app.post("/build", corsOptions, (req, res) => { +app.post("/build", (req, res) => { exec("cd ../ && gatsby build", (error, stdout, stderr) => { if (error) { console.log(stderr.message)