From 55bec002e624ffabd7df6afefa8f16279fb4d61b Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 1 Sep 2022 18:46:49 +0400 Subject: [PATCH] whats going on w cors!! --- account/src/index.ts | 6 +++++- account/src/routers/api-router.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/account/src/index.ts b/account/src/index.ts index c7881e7..c05e3c3 100644 --- a/account/src/index.ts +++ b/account/src/index.ts @@ -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()); diff --git a/account/src/routers/api-router.ts b/account/src/routers/api-router.ts index 369eacc..5d96f3d 100644 --- a/account/src/routers/api-router.ts +++ b/account/src/routers/api-router.ts @@ -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;