summaryrefslogtreecommitdiffstats
path: root/src/api.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-10-12 18:23:46 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-10-12 18:23:46 -0500
commit8b9eb6eb88d871309348dff1527d69b4b32a98ec (patch)
tree4a8d25f3b0db4a6ff7c258f3ea7a508e6b68de82 /src/api.rs
parent0ea877c5d0de10b45768da80c658785835d625e6 (diff)
refactor: simplify service trait, again
Diffstat (limited to 'src/api.rs')
-rw-r--r--src/api.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/api.rs b/src/api.rs
index bab2043..57dc4b7 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -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())
}