Spaces:
Sleeping
Sleeping
added port listener
Browse files
app.js
CHANGED
|
@@ -7,6 +7,16 @@ dotenv.config();
|
|
| 7 |
const app = express();
|
| 8 |
const port = process.env.PORT; // Hugging Face will set this dynamically
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
app.use(bodyParser.urlencoded({ extended: true }));
|
| 12 |
app.use(express.static('public'));
|
|
|
|
| 7 |
const app = express();
|
| 8 |
const port = process.env.PORT; // Hugging Face will set this dynamically
|
| 9 |
|
| 10 |
+
if (!port) {
|
| 11 |
+
console.error("❌ PORT not defined");
|
| 12 |
+
process.exit(1);
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
app.listen(port, () => {
|
| 16 |
+
console.log(`✅ Server listening on port ${port}`);
|
| 17 |
+
});
|
| 18 |
+
|
| 19 |
+
|
| 20 |
|
| 21 |
app.use(bodyParser.urlencoded({ extended: true }));
|
| 22 |
app.use(express.static('public'));
|