demo-app/src/index.ts
Noah Holt 1365bd7644
All checks were successful
/ checks (push) Successful in 9s
/ deploy (push) Successful in 7s
refactor: migrate from node:http to Express with Express.js tests
2026-08-10 23:03:24 -05:00

23 lines
494 B
TypeScript

import express from "express";
import { hostname } from "node:os";
import { greeting } from "./greeting.js";
const app = express();
const port = Number(process.env.PORT ?? 3000);
const sha = process.env.GIT_SHA ?? "dev";
app.get("/healthz", (_req, res) => {
res.type("text/plain").send("ok");
});
app.get("/", (_req, res) => {
res.json({
service: "demo-app",
message: greeting(),
sha,
pod: hostname(),
time: new Date().toISOString(),
});
});
export { app, port };