Skip to content

Commit f029b9a

Browse files
Updated index.js
1 parent d3d6900 commit f029b9a

4 files changed

Lines changed: 3 additions & 202 deletions

File tree

DEPLOYMENT.md

Lines changed: 0 additions & 140 deletions
This file was deleted.

render.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

server/index.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,10 @@ import cors from 'cors';
55

66
const app = express();
77
const server = createServer(app);
8-
9-
const allowedOrigins = [
10-
"http://localhost:5173",
11-
"https://localhost:5173",
12-
"http://localhost:5174",
13-
"https://securecomm.netlify.app",
14-
process.env.FRONTEND_URL
15-
].filter(Boolean);
16-
178
const io = new Server(server, {
189
cors: {
19-
origin: (origin, callback) => {
20-
if (!origin || allowedOrigins.includes(origin) || origin.includes('render.com')) {
21-
callback(null, true);
22-
} else {
23-
callback(new Error('Not allowed by CORS'));
24-
}
25-
},
26-
methods: ["GET", "POST"],
27-
credentials: true
10+
origin: ["http://localhost:5173", "https://securecomm.netlify.app"],
11+
methods: ["GET", "POST"]
2812
}
2913
});
3014

src/hooks/useSocket.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,11 @@ export function useSocket({
3838

3939
// Determine server URL based on environment
4040
const getServerUrl = () => {
41-
// Check for environment variable first
42-
const envServerUrl = import.meta.env.VITE_SERVER_URL;
43-
if (envServerUrl) {
44-
return envServerUrl;
45-
}
46-
4741
// In development, use localhost
4842
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
4943
return 'http://localhost:3001';
5044
}
51-
45+
5246
// In production, use the deployed server
5347
return 'https://panger-chat-server.onrender.com';
5448
};

0 commit comments

Comments
 (0)