File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,26 +5,10 @@ import cors from 'cors';
55
66const app = express ( ) ;
77const 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-
178const 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
Original file line number Diff line number Diff 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 } ;
You can’t perform that action at this time.
0 commit comments