17 lines
992 B
JavaScript
17 lines
992 B
JavaScript
// Заглушка продукта (PEP-145): пока в проекте нет своего приложения, по ссылке открывается
|
|
// страница «Продукт создаётся». Слушает $PORT, отвечает 200 на GET /healthz. Первая задача,
|
|
// которая делает настоящий продукт, заменяет этот каталог и Dockerfile своими.
|
|
import { createServer } from "node:http";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
const page = readFileSync(new URL("./index.html", import.meta.url));
|
|
const port = Number(process.env.PORT ?? 3000);
|
|
|
|
createServer((req, res) => {
|
|
if (req.url === "/healthz") {
|
|
res.writeHead(200, { "content-type": "text/plain; charset=utf-8" }).end("ok");
|
|
return;
|
|
}
|
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" }).end(page);
|
|
}).listen(port, "0.0.0.0", () => console.log(`product placeholder on :${port}`));
|