summaryrefslogtreecommitdiffstats
path: root/src/api.rs
blob: 57dc4b7d9a26e39d4f1e000c9f91d542cb87dd83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use axum::{extract::State, routing::get, Json};

use crate::AppState;

pub mod services;
pub mod sse;

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())
}