;; lib/host/router.sx — Host application assembly. A host app is a single Dream ;; router built from per-domain route groups, with a built-in health endpoint and ;; a JSON 404 fallback so the native OCaml HTTP server has one entry point: ;; request -> response. Each subsystem contributes a list of Dream routes (see ;; lib/host/feed.sx); host/make-app concatenates them under one router. ;; dr/flatten-routes (Dream) flattens the nested groups, so a group is just a list ;; of routes. Depends on lib/dream/router.sx + lib/host/handler.sx. ;; Liveness probe — GET /health -> 200 {"ok":true,"data":"healthy"}. (define host/health-route (dream-get "/health" (fn (req) (host/ok "healthy")))) ;; Build the host app from a list of route groups (each a list of Dream routes). ;; The health route is always mounted first; Dream's router returns a JSON-free ;; 404 for unmatched paths, which host endpoints override per-domain as needed. (define host/make-app (fn (groups) (dream-router (cons host/health-route groups))))