Skip to content

Commit 0eb73c3

Browse files
test(deployment)
1 parent 83f4232 commit 0eb73c3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backend/server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ dotenv.config();
99
const app = express();
1010
const PORT = process.env.PORT || 8000;
1111

12+
const allowedOrigin = process.env.FRONTEND_URL || 'http://localhost:3000';
13+
1214
// Middleware
1315
app.use(cors({
14-
origin: process.env.FRONTEND_URL || 'http://localhost:3000',
15-
credentials: true
16+
origin: allowedOrigin,
17+
credentials: true,
1618
}));
1719
app.use(express.json());
1820
app.use(express.urlencoded({ extended: true }));
@@ -66,6 +68,7 @@ app.use('*', (req, res) => {
6668
if (process.env.NODE_ENV !== 'test') {
6769
app.listen(PORT, () => {
6870
console.log(`🚀 GoPredict API Server running on port ${PORT}`);
71+
console.log(`✅ CORS enabled for origin: ${allowedOrigin}`);
6972
console.log(`📊 Health check: http://localhost:${PORT}/api/health`);
7073
console.log(`🔮 Prediction endpoint: http://localhost:${PORT}/api/predict`);
7174
});

0 commit comments

Comments
 (0)