Skip to content

Commit 04ed0f8

Browse files
committed
Update cors
1 parent 0c5f684 commit 04ed0f8

File tree

1 file changed

+3
-3
lines changed
  • backend/question-service

1 file changed

+3
-3
lines changed

backend/question-service/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import questionRoutes from "./src/routes/questionRoutes.ts";
1010

1111
dotenv.config();
1212

13-
const origin = process.env.ORIGINS
13+
const allowedOrigins = process.env.ORIGINS
1414
? process.env.ORIGINS.split(",")
1515
: ["http://localhost:5173", "http://127.0.0.1:5173"];
1616

@@ -21,8 +21,8 @@ const app = express();
2121

2222
connectDB();
2323

24-
app.use(cors({ origin: origin, credentials: true }));
25-
app.options("*", cors());
24+
app.use(cors({ origin: allowedOrigins, credentials: true }));
25+
app.options("*", cors({ origin: allowedOrigins, credentials: true }));
2626

2727
// To handle CORS Errors
2828
app.use((req: Request, res: Response, next: NextFunction) => {

0 commit comments

Comments
 (0)