Initial commit
Some checks are pending
/ checks (push) Waiting to run
/ deploy (push) Blocked by required conditions

This commit is contained in:
Noah Holt 2026-08-10 21:44:23 -05:00
commit 5d4f3c0965
11 changed files with 194 additions and 0 deletions

3
src/greeting.ts Normal file
View file

@ -0,0 +1,3 @@
export function greeting(): string {
return "Hello from the homelab pipeline!";
}

7
src/index.test.ts Normal file
View file

@ -0,0 +1,7 @@
import test from "node:test";
import assert from "node:assert/strict";
import { greeting } from "./greeting.js";
test("greeting mentions the homelab", () => {
assert.match(greeting(), /homelab/);
});

32
src/index.ts Normal file
View file

@ -0,0 +1,32 @@
import { createServer } from "node:http";
import { hostname } from "node:os";
import { greeting } from "./greeting.js";
const port = Number(process.env.PORT ?? 3000);
const sha = process.env.GIT_SHA ?? "dev";
const server = createServer((req, res) => {
if (req.url === "/healthz") {
res.writeHead(200, { "content-type": "text/plain" });
res.end("ok");
return;
}
res.writeHead(200, { "content-type": "application/json" });
res.end(
JSON.stringify(
{
service: "demo-app",
message: greeting(),
sha,
pod: hostname(),
time: new Date().toISOString(),
},
null,
2,
) + "\n",
);
});
server.listen(port, () => {
console.log(`demo-app ${sha} listening on :${port}`);
});