Spaces:
Sleeping
Sleeping
File size: 621 Bytes
c674d8a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | // 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}`);
}); |