diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index e2864df..da5c4d1 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -6,10 +6,26 @@ pub mod search; pub mod stats; pub mod ws; -use axum::{routing::{get, post}, Router}; +use axum::{routing::{get, post}, Json, Router}; use tower_http::cors::CorsLayer; use crate::state::SharedState; +async fn index() -> Json { + Json(serde_json::json!({ + "service": "ares-next", + "version": env!("CARGO_PKG_VERSION"), + "endpoints": [ + "GET /api/v1/health", + "GET /api/v1/search?q=...", + "GET /api/v1/files/{file_id}", + "POST /api/v1/announce", + "GET /api/v1/peers/{file_id}", + "GET /api/v1/stats", + "WS /api/v1/tracker/ws" + ] + })) +} + pub fn router(state: SharedState) -> Router { let api = Router::new() .route("/health", get(health::health)) @@ -22,6 +38,7 @@ pub fn router(state: SharedState) -> Router { .with_state(state); Router::new() + .route("/", get(index)) .nest("/api/v1", api) .layer(CorsLayer::permissive()) } \ No newline at end of file