diff --git a/apps/backend/src/index.ts b/apps/backend/src/index.ts index bd0a8a7..1ade2bc 100644 --- a/apps/backend/src/index.ts +++ b/apps/backend/src/index.ts @@ -1,6 +1,7 @@ import { Hono } from "hono" import { cors } from "hono/cors" import { logger } from "hono/logger" +import { serveStatic } from "hono/bun" import weather from "./weather" import tfl from "./tfl" import beszel from "./beszel" @@ -10,10 +11,6 @@ const app = new Hono() app.use("*", logger()) app.use("*", cors()) -app.get("/", (c) => { - return c.json({ message: "Hello from Bun + Hono!" }) -}) - app.get("/api/health", (c) => { return c.json({ status: "ok", timestamp: new Date().toISOString() }) }) @@ -27,6 +24,12 @@ app.route("/api/tfl", tfl) // Mount Beszel routes app.route("/api/beszel", beszel) +// Serve static files from dashboard build +app.use("/*", serveStatic({ root: "../dashboard/dist" })) + +// Fallback to index.html for client-side routing +app.get("*", serveStatic({ path: "../dashboard/dist/index.html" })) + export default { port: 8000, fetch: app.fetch,