GWM : cors changes

This commit is contained in:
Gowtham M 2025-12-04 13:41:50 +05:30
parent dc3a1d824d
commit fd55167a21

View File

@ -28,7 +28,20 @@ app.use(cors({
credentials: true
}));
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", req.headers.origin);
res.header("Access-Control-Allow-Credentials", "true");
res.header(
"Access-Control-Allow-Headers",
"Content-Type, Authorization, APP_SIGNATURE, x-app-signature"
);
res.header(
"Access-Control-Allow-Methods",
"GET, POST, PUT, PATCH, DELETE, OPTIONS"
);
if (req.method === "OPTIONS") {
return res.sendStatus(200);
}
next();
});
@ -122,9 +135,6 @@ app.post("/deploy", deploymentController.deployment);
// console.log("✅ Database connected & synced.");
// });
// Start server
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {