use axum::{routing::get, Router, extract::State}; use crate::state::AppState; pub fn create_router(app_state: AppState) -> Router { Router::new() .route("/health", get(health_check)) .route("/tasks", get(get_tasks)) .with_state(app_state) } async fn health_check(State(_state): State) -> &'static str { "OK" } async fn get_tasks(State(state): State) -> axum::Json> { let tasks = state .tasks .iter() .map(|kv| kv.value().clone()) .collect::>(); axum::Json(tasks) }