feat(integration): WS bridge + Tower + payment panel + E2E test [10/10 PASS] (#26)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user