import express from "express"; import { createServer } from "http"; import path from "path"; import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); async function startServer() { const app = express(); const server = createServer(app); const staticPath = path.resolve(__dirname, "..", "dist"); app.use(express.static(staticPath)); // Handle client-side routing — entry is i.html (see vite rollup input) app.get("*", (_req, res) => { res.sendFile(path.join(staticPath, "i.html")); }); const port = process.env.PORT || 3000; server.listen(port, () => { console.log(`Server running on http://localhost:${port}/`); }); } startServer().catch(console.error);