spb/hilmacorp-ca
Public
1// Hilmacorp — page « en construction » (www.hilmacorp.ca)2// Auteur : Simon-Pierre Boucher / contact@spboucher.ai3import http from "node:http";4import { readFileSync } from "node:fs";5import { join, dirname } from "node:path";6import { fileURLToPath } from "node:url";78const __dirname = dirname(fileURLToPath(import.meta.url));9const PORT = Number(process.argv[2] || process.env.PORT || 8070);10const html = readFileSync(join(__dirname, "public", "index.html"));11const started = new Date().toISOString();1213http.createServer((req, res) => {14 const url = (req.url || "/").split("?")[0];15 if (url === "/healthz") {16 res.writeHead(200, { "content-type": "application/json" });17 return res.end(JSON.stringify({ ok: true, app: "hilmacorp-ca", started }));18 }19 if (url === "/robots.txt") {20 res.writeHead(200, { "content-type": "text/plain" });21 return res.end("User-agent: *\nDisallow:\n");22 }23 res.writeHead(url === "/" || url === "/index.html" ? 200 : 404, {24 "content-type": "text/html; charset=utf-8",25 "cache-control": "no-cache",26 });27 res.end(html);28}).listen(PORT, "0.0.0.0", () => console.log(`hilmacorp-ca listening on :${PORT}`));29