pub fn build_router(state: Arc<ServerState>) -> RouterExpand description
Build the axum router with all API endpoints and OpenAPI doc routes.
Structure:
/v2/*— the main resource router, with the globalServerState::request_timeoutapplied as an outerTimeoutLayer.POST /powernow returns immediately with a PCS transition id (the polling loop runs CLI-side), so it fits well under the default timeout — no per-route override is needed./v2/auth/*— separate sub-router with two layered defences: per-IP rate limit (seeAuthRateLimiter) and body redaction from any log span (seestrip_body_for_logs). No Bearer-token extractor (these endpoints issue the token)./docs+/openapi.json— Swagger UI and the spec fromApiDoc.- HSTS header injected on every response by an
add_hsts_headermiddleware (private to this module).