Files
HexaHost-GameCloud/apps/api/src/main.ts
smueller e37ea87b35
Some checks failed
CI / Go — node-agent tests (push) Has been cancelled
CI / Go — edge-gateway build (push) Has been cancelled
CI / Node — lint, typecheck, test, build (push) Has been cancelled
initial commit
2026-06-26 10:45:08 +02:00

27 lines
702 B
TypeScript

import http from "node:http";
const port = Number(process.env.API_PORT ?? 3001);
const appName = process.env.APP_NAME ?? "HexaHost GameCloud";
const server = http.createServer((req, res) => {
if (req.url === "/healthz" || req.url === "/health") {
res.writeHead(200, { "Content-Type": "application/json" });
res.end(
JSON.stringify({
status: "ok",
service: "api",
app: appName,
phase: "0",
}),
);
return;
}
res.writeHead(404, { "Content-Type": "application/json" });
res.end(JSON.stringify({ status: "not_found" }));
});
server.listen(port, () => {
console.log(JSON.stringify({ level: "info", msg: "api listening", port }));
});