/** * server/index.ts — LEGACY STATIC-ONLY ENTRY POINT * * @deprecated This file is NOT used in production or development. * * The real application server is: server/_core/index.ts * - Registers tRPC router (/api/trpc) * - Registers OAuth routes (/api/oauth/callback) * - Runs Vite middleware in development * - Serves pre-built static assets in production (dist/public) * - Seeds default agents on startup * * This file was the original minimal static server created before * tRPC integration. It has NO tRPC routes, NO OAuth, NO seed logic. * * Build entrypoint (tsconfig/vite.config) → server/_core/index.ts * Dockerfile CMD → node dist/index.js (compiled from _core/index.ts) * * ⚠️ DO NOT add business logic here. * DO NOT run this file directly in production. * It is kept as a historical artefact and may be removed in a future * cleanup phase (see todo.md Phase 17 — technical debt). */ import express from "express"; import { createServer } from "http"; import path from "path"; import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); async function startServer() { const app = express(); const server = createServer(app); // Serve static files from dist/public in production const staticPath = process.env.NODE_ENV === "production" ? path.resolve(__dirname, "public") : path.resolve(__dirname, "..", "dist", "public"); app.use(express.static(staticPath)); // Handle client-side routing — serve index.html for all routes app.get("*", (_req, res) => { res.sendFile(path.join(staticPath, "index.html")); }); const port = process.env.PORT || 3000; server.listen(port, () => { console.log(`[LEGACY] Static-only server running on http://localhost:${port}/`); console.log("[LEGACY] WARNING: This server has no tRPC routes. Use server/_core/index.ts instead."); }); } startServer().catch(console.error);