ledgerflow-frontend/serve.js
Adam Moussa 4fbd664d64 Initial commit — LedgerFlow frontend
Single-page B2B accounting app with PO management (import, edit),
invoice creation with auto due date calculation, EDI preview/submit,
Google SSO, and sign out support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 18:19:49 -04:00

39 lines
967 B
JavaScript

// 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`);
});