diff --git a/src/api/mod.rs b/src/api/mod.rs index 580f757..d016119 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -3,7 +3,8 @@ mod admin; mod project; mod user; -use actix_web::{web, App, HttpServer}; +use actix_web::http::header::ContentType; +use actix_web::{web, App, HttpResponse, HttpServer, Responder}; use anyhow::Result; use log::info; use sqlx::postgres::PgPool; @@ -102,6 +103,8 @@ pub async fn start(port: u16, pool: PgPool) -> Result<()> { .service( web::scope("/admin/backup").default_service(web::to(admin::calls::backup_forward)), ) + .route("/", web::get().to(index)) + .route("/index.html", web::get().to(index)) .app_data(web::Data::new(ApiState { pool: pool.clone() })) }) .bind(("0.0.0.0", port))? @@ -110,3 +113,17 @@ pub async fn start(port: u16, pool: PgPool) -> Result<()> { Ok(()) } + +async fn index() -> impl Responder { + HttpResponse::Ok().content_type(ContentType::html()).body(r#" + +
+This is a http API and by that intended to be used as an interface for applications.
+Documentation on how to use this API can be found here.
+ + + "#) +}