diff --git a/src/aggregator/index.ts b/src/aggregator/index.ts index b53357c..bf07141 100644 --- a/src/aggregator/index.ts +++ b/src/aggregator/index.ts @@ -91,16 +91,7 @@ export class BacklogAggregator { port: this.config.port, development: process.env.NODE_ENV === "development", routes: { - "/": async () => { - const htmlPath = pathJoin(__dirname, "web", "index.html"); - const htmlFile = Bun.file(htmlPath); - return new Response(htmlFile, { headers: { "Content-Type": "text/html" } }); - }, - "/app.tsx": async () => { - const tsxPath = pathJoin(__dirname, "web", "app.tsx"); - const tsxFile = Bun.file(tsxPath); - return new Response(tsxFile, { headers: { "Content-Type": "application/javascript" } }); - }, + // NOTE: "/" route is handled in fetch() to allow WebSocket upgrade "/api/projects": { GET: async () => this.handleGetProjects(), }, @@ -138,6 +129,13 @@ export class BacklogAggregator { }); } + // Serve the HTML app for root path + if (url.pathname === "/" || url.pathname === "") { + const htmlPath = pathJoin(__dirname, "web", "index.html"); + const htmlFile = Bun.file(htmlPath); + return new Response(htmlFile, { headers: { "Content-Type": "text/html" } }); + } + return new Response("Not Found", { status: 404 }); }, websocket: {