feat: add minimal frontend and backend CI demo

This commit is contained in:
2026-10-29 08:32:36 +00:00
parent 8b4495cb9f
commit 20182b4dae
6 changed files with 143 additions and 0 deletions

26
be/server.js Normal file
View File

@@ -0,0 +1,26 @@
const { createServer } = require("node:http");
const port = Number(process.env.PORT || 8080);
function sendJson(response, status, body) {
response.writeHead(status, { "content-type": "application/json; charset=utf-8" });
response.end(JSON.stringify(body));
}
const server = createServer((request, response) => {
const pathname = new URL(request.url || "/", "http://localhost").pathname;
if (request.method === "GET" && (pathname === "/" || pathname === "/health")) {
return sendJson(response, 200, { status: "ok", service: "be" });
}
if (request.method === "GET" && pathname === "/api/hello") {
return sendJson(response, 200, { service: "be", message: "Hello from the backend" });
}
return sendJson(response, 404, { error: "Not found" });
});
server.listen(port, "0.0.0.0", () => {
console.log(`BE listening on port ${port}`);
});