cors work

This commit is contained in:
lingdocs 2022-09-03 17:46:17 +04:00
parent a52e39a0e6
commit c328e69476
1 changed files with 0 additions and 6 deletions

View File

@ -15,15 +15,9 @@ app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static("public"));
app.use(cors({
// origin: "*",
origin: inProd ? /\.lingdocs\.com$/ : "*",
credentials: true,
}));
app.use((req, res, next) => {
// res.append('Access-Control-Allow-Origin', ['*']);
res.append('Access-Control-Allow-Methods', 'GET,HEAD,PUT,POST,DELETE,OPTIONS');
next();
});
if (inProd) app.set('trust proxy', 1);
setupSession(app);
app.use(passport.initialize());