use axum::{http::StatusCode, routing::get}; use crate::{error::AppError, state::AppState}; mod account_members; mod accounts; mod auth_passkey; mod auth_token; mod dtos; mod errors; pub mod extractors; mod scheduled_transactions; mod transactions; mod user_app_secrets; mod user_apps; mod users; pub fn create_router(state: AppState) -> axum::Router { let api = axum::Router::new() .nest("/auth/passkey", auth_passkey::create_router()) .nest("/auth/token", auth_token::create_router()) .nest("/accounts", accounts::create_router()) .nest( "/accounts/{account_id}/members", account_members::create_router(), ) .nest( "/scheduled-transactions", scheduled_transactions::create_router(), ) .nest("/transactions", transactions::create_router()) .nest("/users", users::create_router()) .nest("/users/{user_id}/apps", user_apps::create_router()) .nest( "/users/{user_id}/apps/{app_id}/secrets", user_app_secrets::create_router(), ); axum::Router::new() .nest("/api", api) .route("/health", get(async || StatusCode::NO_CONTENT)) .fallback(async || AppError::NotFound) .with_state(state) }