gaialive commited on
Commit
b125087
·
verified ·
1 Parent(s): ad08f08

Upload 7 files

Browse files
Files changed (3) hide show
  1. server/Dockerfile +1 -1
  2. server/index.js +9 -3
  3. server/package.json +4 -4
server/Dockerfile CHANGED
@@ -8,7 +8,7 @@ WORKDIR /app
8
  COPY package*.json ./
9
 
10
  # Install dependencies
11
- RUN npm ci --only=production
12
 
13
  # Copy application code
14
  COPY . .
 
8
  COPY package*.json ./
9
 
10
  # Install dependencies
11
+ RUN npm install --only=production
12
 
13
  # Copy application code
14
  COPY . .
server/index.js CHANGED
@@ -25,12 +25,18 @@ if (process.env.NODE_ENV === 'development') {
25
  if (origin.startsWith('http://localhost') ||
26
  origin.startsWith('https://localhost') ||
27
  origin.includes('huggingface.co') ||
28
- origin.includes('hf.space')) {
 
 
29
  return callback(null, true);
30
  }
31
 
32
- // Add your production domain here
33
- callback(new Error('Not allowed by CORS'));
 
 
 
 
34
  }
35
  }));
36
  }
 
25
  if (origin.startsWith('http://localhost') ||
26
  origin.startsWith('https://localhost') ||
27
  origin.includes('huggingface.co') ||
28
+ origin.includes('hf.space') ||
29
+ origin === 'http://localhost:80' ||
30
+ origin === 'http://localhost:5173') {
31
  return callback(null, true);
32
  }
33
 
34
+ // Allow same origin requests
35
+ if (origin === `http://localhost:${PORT}`) {
36
+ return callback(null, true);
37
+ }
38
+
39
+ callback(null, true); // Allow all in production for now
40
  }
41
  }));
42
  }
server/package.json CHANGED
@@ -9,13 +9,13 @@
9
  "init-db": "node scripts/init-db.js"
10
  },
11
  "dependencies": {
12
- "express": "^4.18.2",
13
  "cors": "^2.8.5",
14
- "dotenv": "^16.3.1",
15
- "pg": "^8.11.3"
16
  },
17
  "devDependencies": {
18
- "nodemon": "^3.0.2"
19
  },
20
  "engines": {
21
  "node": ">=18.0.0"
 
9
  "init-db": "node scripts/init-db.js"
10
  },
11
  "dependencies": {
12
+ "express": "^4.21.2",
13
  "cors": "^2.8.5",
14
+ "dotenv": "^16.4.7",
15
+ "pg": "^8.13.1"
16
  },
17
  "devDependencies": {
18
+ "nodemon": "^3.1.9"
19
  },
20
  "engines": {
21
  "node": ">=18.0.0"