cors tweak

This commit is contained in:
adueck 2023-07-26 23:53:48 +04:00
parent 65b38085f0
commit ada2c3d706
1 changed files with 7 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import dictionaryRouter from "./routers/dictionary-router";
const sameOriginCorsOpts = {
origin: inProd ? /\.lingdocs\.com$/ : "*",
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
credentials: true,
};
const app = express();
@ -23,7 +24,7 @@ app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static("public"));
if (inProd) app.set('trust proxy', 1);
if (inProd) app.set("trust proxy", 1);
setupSession(app);
app.use(passport.initialize());
app.use(passport.session());
@ -45,6 +46,5 @@ app.use("/feedback", cors(sameOriginCorsOpts), feedbackRouter);
// TODO: check - does this work with the cors ?
app.use("/payment", cors(sameOriginCorsOpts), paymentRouter);
// START 💨 //
app.listen(4000, () => console.log("Server Has Started on 4000"));