Spaces:
Sleeping
Sleeping
| // server.js | |
| import express from "express"; | |
| import path from "path"; | |
| import { fileURLToPath } from "url"; | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); | |
| const app = express(); | |
| const PORT = process.env.PORT || 7860; | |
| // Serve static files from /public | |
| app.use(express.static(path.join(__dirname, "public"), { extensions: ["html"] })); | |
| // Default route (serve index.html) | |
| app.get("/", (req, res) => { | |
| res.sendFile(path.join(__dirname, "public", "index.html")); | |
| }); | |
| app.listen(PORT, "0.0.0.0", () => { | |
| console.log(`✅ Server running at http://localhost:${PORT}`); | |
| }); |