Abhises commited on
Commit
e3eaa0d
·
1 Parent(s): 7bd8a28

Force PORT to 7860 on Hugging Face Spaces

Browse files
Files changed (1) hide show
  1. src/index.js +2 -1
src/index.js CHANGED
@@ -86,7 +86,8 @@ app.use((err, req, res, next) => {
86
  const http = require('http');
87
  const wsManager = require('./lib/ws');
88
 
89
- const PORT = process.env.PORT || 7860;
 
90
  const server = http.createServer(app);
91
 
92
  // Initialize WebSockets
 
86
  const http = require('http');
87
  const wsManager = require('./lib/ws');
88
 
89
+ // Force 7860 on Hugging Face Spaces (which sets SPACE_ID), otherwise use .env PORT or default to 4000
90
+ const PORT = process.env.SPACE_ID ? 7860 : (process.env.PORT || 4000);
91
  const server = http.createServer(app);
92
 
93
  // Initialize WebSockets