diff options
Diffstat (limited to 'src/api.rs')
-rw-r--r-- | src/api.rs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1,3 +1,5 @@ +use axum::{extract::State, routing::get, Json}; + use crate::AppState; pub mod services; @@ -7,4 +9,9 @@ pub fn router() -> axum::Router<AppState> { axum::Router::new() .nest("/sse", sse::router()) .nest("/status", services::router()) + .route("/list", get(names)) +} + +pub async fn names(State(state): State<AppState>) -> Json<Vec<String>> { + Json(state.names()) } |