add dev resources; plumb GUI_ENV_FILE/API_ENV_FILE/API_DESI_DATA into run targets
This commit is contained in:
+12
-2
@@ -1,13 +1,23 @@
|
||||
pub mod catalogs;
|
||||
pub mod health;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::{routing::get, Router};
|
||||
|
||||
/// Builds the application router. Kept separate from `main` so tests can
|
||||
/// construct it without binding a socket.
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user