// Simple local dev server — serves frontend on http://localhost:3000 // Usage: node serve.js const http = require("http"); const fs = require("fs"); const path = require("path"); const PORT = 3000; const DIR = __dirname; const MIME = { ".html": "text/html", ".js": "application/javascript", ".css": "text/css", ".json": "application/json", ".png": "image/png", ".svg": "image/svg+xml", ".ico": "image/x-icon", }; http.createServer((req, res) => { let url = req.url.split("?")[0]; if (url === "/") url = "/login.html"; const filePath = path.join(DIR, url); const ext = path.extname(filePath); fs.readFile(filePath, (err, data) => { if (err) { res.writeHead(404); res.end("Not found"); return; } res.writeHead(200, { "Content-Type": MIME[ext] || "application/octet-stream" }); res.end(data); }); }).listen(PORT, () => { console.log(`\n LedgerFlow frontend: http://localhost:${PORT}\n`); });