All files / src/lib/app/routes dashboard.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                25x 2x 2x 1x     1x      
import type { Hono } from "hono";
import type { AppEnv } from "../types";
 
/**
 * Registers the dashboard redirect route which forwards traffic to the
 * configured dashboard URL when available.
 */
export function registerDashboardRoute(app: Hono<AppEnv>): void {
  app.get("/", (c) => {
    const dashboardUrl = c.env.DASHBOARD_URL;
    if (!dashboardUrl) {
      return c.json({ error: "Dashboard URL not configured" }, 500);
    }
 
    return c.redirect(dashboardUrl, 302);
  });
}