Files
pikasTech-HWLAB/cmd/hwlab-gateway/main.mjs
T
2026-05-21 14:40:31 +00:00

24 lines
803 B
JavaScript

#!/usr/bin/env node
import { createGatewayState, createHealth } from "../../internal/sim/model.mjs";
import { createJsonServer, listen, parsePort } from "../../internal/sim/http.mjs";
const gatewayId = process.env.HWLAB_GATEWAY_ID ?? "gateway_dev_stub";
const port = parsePort(process.env.PORT, 7001);
const state = createGatewayState({
gatewayId,
serviceId: "hwlab-gateway",
endpoint: `http://127.0.0.1:${port}`,
boxes: []
});
state.session.status = "starting";
const routes = new Map();
routes.set("GET /health/live", () => createHealth({ serviceId: "hwlab-gateway", name: gatewayId }));
routes.set("GET /status", () => ({
...state,
note: "L2/L3 skeleton only; real hardware integration is intentionally absent for MVP simulator work."
}));
listen(createJsonServer({ routes }), port);