feat: add cloud api skeleton

This commit is contained in:
HWLAB Code Queue
2026-05-21 14:39:30 +00:00
parent 8f3069035f
commit b1d31380cb
10 changed files with 1004 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env node
import { createCloudApiServer } from "../../internal/cloud/server.mjs";
const host = process.env.HWLAB_CLOUD_API_HOST || "0.0.0.0";
const port = Number.parseInt(process.env.HWLAB_CLOUD_API_PORT || process.env.PORT || "6667", 10);
const server = createCloudApiServer();
server.listen(port, host, () => {
const address = server.address();
const resolvedPort = typeof address === "object" && address ? address.port : port;
process.stdout.write(
`${JSON.stringify({
serviceId: "hwlab-cloud-api",
status: "listening",
host,
port: resolvedPort
})}\n`
);
});
for (const signal of ["SIGINT", "SIGTERM"]) {
process.on(signal, () => {
server.close(() => {
process.exit(0);
});
});
}