GWM : cors changes
This commit is contained in:
parent
dc3a1d824d
commit
fd55167a21
16
server.js
16
server.js
@ -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, () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user