Skip to content

Commit

Permalink
configured cors
Browse files Browse the repository at this point in the history
  • Loading branch information
DevKrishnasai committed Aug 20, 2024
1 parent c1df155 commit 1e47389
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const app = express();
const httpserver = http.createServer(app);
export const io = new Server(httpserver, {
cors: {
origin: [process.env.FRONTEND_URL1, process.env.FRONTEND_URL2],
origin: "*",
},
});

Expand All @@ -33,10 +33,16 @@ cron.schedule("*/1 * * * *", async () => {

// Middlewares
app.use(express.json());
// app.use(
// cors({
// //allow 2 frontend urls to access the server
// origin: [process.env.FRONTEND_URL1, process.env.FRONTEND_URL2],
// })
// );

app.use(
cors({
//allow 2 frontend urls to access the server
origin: [process.env.FRONTEND_URL1, process.env.FRONTEND_URL2],
origin: "*",
})
);

Expand Down

0 comments on commit 1e47389

Please # to comment.