Spaces:
Sleeping
Sleeping
Upload 7 files
Browse files- server/Dockerfile +1 -1
- server/index.js +9 -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
|
| 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 |
-
//
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.
|
| 13 |
"cors": "^2.8.5",
|
| 14 |
-
"dotenv": "^16.
|
| 15 |
-
"pg": "^8.
|
| 16 |
},
|
| 17 |
"devDependencies": {
|
| 18 |
-
"nodemon": "^3.
|
| 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"
|