Files
MCMapper-Backend/api/src/index.ts
T
octoturge 4c7cc26281 Phase 0: scaffold three-service backend (api/worker/frontend)
api/ (ElysiaJS+Bun WS gateway skeleton), worker/ (Rust, Redis dirty-chunk
stream consumer behind a swappable RenderBackend trait), frontend/
(ElysiaJS+Pug+Tailwind4+Alpine, one server-rendered page) — all three
verified running locally. docker-compose wires them up with postgres,
redis, minio (rendered tile/mesh object storage), and Caddy as reverse
proxy.
2026-08-08 14:10:04 +02:00

22 lines
707 B
TypeScript

import { Elysia } from "elysia";
// Phase 0 skeleton: health check + a bare WS gateway endpoint that mod instances will
// eventually authenticate against with a per-server token (see plan's "WS Gateway" module).
// Delta/chat/link-request routing lands in Phase 1+.
const app = new Elysia()
.get("/health", () => ({ status: "ok" }))
.ws("/ws", {
open(ws) {
console.log(`[ws] connection opened: ${ws.id}`);
},
message(ws, message) {
console.log(`[ws] message from ${ws.id}:`, message);
},
close(ws) {
console.log(`[ws] connection closed: ${ws.id}`);
},
})
.listen(Number(process.env.PORT ?? 3000));
console.log(`[api] listening on :${app.server?.port}`);