Spaces:
Sleeping
Sleeping
Create app.js
Browse files
app.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const express = require('express');
|
| 2 |
+
const app = express();
|
| 3 |
+
|
| 4 |
+
// Middleware to parse JSON bodies
|
| 5 |
+
app.use(express.json());
|
| 6 |
+
|
| 7 |
+
app.post('/', (req, res) => {
|
| 8 |
+
console.log("Received JSON:", req.body);
|
| 9 |
+
res.json({ status: "success", message: "Data received" });
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
// Use the same port as before or use environment variable PORT
|
| 13 |
+
const PORT = process.env.PORT || 7860;
|
| 14 |
+
app.listen(PORT, () => {
|
| 15 |
+
console.log(`Server running on port ${PORT}`);
|
| 16 |
+
});
|