pub fn build_router(state: AppState) -> RouterExpand description
Assembles every route module into one [axum::Router], ready to serve or to drive
directly in a test via tower::ServiceExt::oneshot.
Alongside the JSON API routes, this mounts the OpenAPI contract itself two ways: the raw
document at GET /api/openapi.json (for tooling – CI’s spec-diff gate, and the generated
frontend/ TS client) and an interactive Scalar UI at /api/docs (for a human exploring
the API in a browser). [utoipa_scalar::Scalar::with_url] returns a state-generic
axum::Router<S> with the UI’s one route already attached, so it merges in directly
rather than needing its own handler function.
Everything that isn’t one of those routes falls through to the SPA fallback handler, which
serves the built React SPA – so this one router is the whole HTTP surface of a real
bhtune-server deployment, API and UI alike. None of the merged sub-routers set their own
fallback (axum panics if two merged routers each declare one), so this is the only place
.fallback is called.