whats going on w cors!!

This commit is contained in:
lingdocs 2022-09-01 18:46:49 +04:00
parent 4127c4f1a4
commit 55bec002e6
2 changed files with 6 additions and 1 deletions

View File

@ -14,7 +14,11 @@ app.set("view engine", "ejs");
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static("public"));
app.use(cors({ origin: inProd ? /\.lingdocs\.com$/ : "*", credentials: true }));
app.use(cors({
origin: "*",
// origin: inProd ? /\.lingdocs\.com$/ : "*",
credentials: true,
}));
if (inProd) app.set('trust proxy', 1);
setupSession(app);
app.use(passport.initialize());

View File

@ -48,6 +48,7 @@ apiRouter.get("/user", (req, res, next) => {
* adds (passed) test results to the record of the user signed in
*/
apiRouter.put("/user/tests", async (req, res, next) => {
console.log("came into the tests route", req.body.tests);
if (!req.user) return next("user not found");
try {
const { tests } = req.body as T.PostTestResultsBody;