Skip to content

Commit 2676423

Browse files
committed
Added dynamic porting for the application!
1 parent 0f661d2 commit 2676423

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/helpers/sockets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const sendToOnlineReceivers = (data, currentlyOnlineEmail, eventName) =>
3737
export const socketConnection = (server) => {
3838
io = new Server(server, {
3939
cors: {
40-
origin: [process.env.CLIENT_URL, "http://localhost:3000"]
40+
origin: [process.env.CLIENT_URL, "http://localhost:3000", `http://localhost:${process.env.PORT || 3000}`],
4141
},
4242
});
4343
io.on("connection", (socket) => {

starter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const app = new Express();
3232
const DEPLOYMENT_API_URL = process.env.DEPLOYMENT_API_URL;
3333
const CLIENT_URL = process.env.CLIENT_URL;
3434

35-
const allowedOrigins = [CLIENT_URL, DEPLOYMENT_API_URL, "http://localhost:3000"];
35+
const allowedOrigins = [CLIENT_URL, DEPLOYMENT_API_URL, "http://localhost:3000", `http://localhost:${process.env.PORT || 3000}`];
3636

3737
const corsOptions = {
3838
origin: (origin, callback) => {

0 commit comments

Comments
 (0)