perf(web): batch dashboard tile hydration

This commit is contained in:
vince 2026-06-20 15:12:18 +02:00
parent 63b008095f
commit de87464ef1
7 changed files with 518 additions and 40 deletions

View file

@ -1,6 +1,10 @@
import { extname, normalize } from "node:path";
import { handleAgentDashboardRoute } from "./routes/agent-dashboard";
import { handleDashboardRoute, handleDashboardTileRoute } from "./routes/dashboard";
import {
handleDashboardRoute,
handleDashboardTileRoute,
handleDashboardTilesRoute,
} from "./routes/dashboard";
const host = process.env.HOST || "0.0.0.0";
const port = Number(process.env.PORT || 3000);
@ -23,6 +27,11 @@ export async function handleRequest(request: Request): Promise<Response> {
return handleDashboardRoute();
}
if (url.pathname === "/api/dashboard/tiles") {
if (request.method !== "POST") return methodNotAllowed(["POST"]);
return handleDashboardTilesRoute(request);
}
if (url.pathname.startsWith("/api/dashboard/tile/")) {
if (request.method !== "GET") return methodNotAllowed(["GET"]);
return handleDashboardTileRoute(url.pathname);