feat(integration): WS bridge + Tower + payment panel + E2E test [10/10 PASS] (#26)

This commit is contained in:
2026-03-18 21:20:51 -04:00
parent 3031c399ee
commit e088ca4cd8
11 changed files with 974 additions and 37 deletions

View File

@@ -1,8 +1,12 @@
import express, { type Express } from "express";
import cors from "cors";
import path from "path";
import { fileURLToPath } from "url";
import router from "./routes/index.js";
import { responseTimeMiddleware } from "./middlewares/response-time.js";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const app: Express = express();
app.set("trust proxy", 1);
@@ -45,7 +49,16 @@ app.use(responseTimeMiddleware);
app.use("/api", router);
app.get("/", (_req, res) => res.redirect("/api/ui"));
// ── Tower (Matrix 3D frontend) ───────────────────────────────────────────────
// Serve the pre-built Three.js world at /tower. The Matrix's WebSocket client
// auto-connects to /api/ws on the same host.
// __dirname resolves to artifacts/api-server/dist/ at runtime.
// Go up three levels to reach workspace root, then into the-matrix/dist.
const towerDist = path.join(__dirname, "..", "..", "..", "the-matrix", "dist");
app.use("/tower", express.static(towerDist));
app.get("/tower/*splat", (_req, res) => res.sendFile(path.join(towerDist, "index.html")));
app.get("/", (_req, res) => res.redirect("/tower"));
app.get("/api", (_req, res) => res.redirect("/api/ui"));
export default app;