27 lines
614 B
Rust
27 lines
614 B
Rust
//! HTTP API: router, handlers, and OpenAPI document.
|
|
|
|
mod health;
|
|
mod openapi;
|
|
mod public;
|
|
|
|
use axum::Router;
|
|
use db::Db;
|
|
|
|
/// Shared application state passed to handlers.
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
/// Database handle for this organization.
|
|
pub db: Db,
|
|
/// User-facing product name (from config). Never hardcoded.
|
|
pub app_name: String,
|
|
}
|
|
|
|
/// Build the application router from shared state.
|
|
pub fn build_app(state: AppState) -> Router {
|
|
Router::new()
|
|
.merge(health::routes())
|
|
.merge(openapi::routes())
|
|
.merge(public::routes())
|
|
.with_state(state)
|
|
}
|