24 lines
708 B
Rust
24 lines
708 B
Rust
pub mod catalogs;
|
|
pub mod health;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use axum::{routing::get, Router};
|
|
|
|
use crate::store::CatalogStore;
|
|
|
|
/// Builds the application router with a static placeholder store. Kept
|
|
/// separate from `main` so tests can construct it without binding a socket.
|
|
pub fn app() -> Router {
|
|
app_with_state(Arc::new(CatalogStore::placeholder()))
|
|
}
|
|
|
|
/// Builds the application router serving the given catalog store.
|
|
pub fn app_with_state(state: Arc<CatalogStore>) -> Router {
|
|
Router::new()
|
|
.route("/health", get(health::health))
|
|
.route("/api/v1/catalogs", get(catalogs::list_catalogs))
|
|
.route("/api/v1/objects", get(catalogs::list_objects))
|
|
.with_state(state)
|
|
}
|