//! The router. //! //! One function, used by both `main` and the tests. v1's integration suite //! rebuilt the route table itself, which meant it tested a copy — and when the //! real one changed, the copy silently kept passing until it stopped compiling //! altogether. use crate::routes; use crate::state::AppState; use axum::Router; use axum::routing::{get, post}; use tower_http::trace::TraceLayer; pub fn router(state: AppState) -> Router { Router::new() .route("/api/health", get(routes::health)) .route("/api/auth/login", post(routes::auth::login)) .route("/api/auth/logout", post(routes::auth::logout)) .route("/api/auth/session", get(routes::auth::current_session)) .layer(TraceLayer::new_for_http()) .with_state(state) }