aboutsummaryrefslogtreecommitdiffstats
path: root/src/web_server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/web_server.rs')
-rw-r--r--src/web_server.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/web_server.rs b/src/web_server.rs
index 0342a38..0097fb1 100644
--- a/src/web_server.rs
+++ b/src/web_server.rs
@@ -5,6 +5,8 @@ use actix::{Addr, SyncArbiter};
use actix_web::{
get, http::header, middleware::Logger, post, web, App, HttpResponse, HttpServer, Responder,
};
+use askama::actix_web::TemplateIntoResponse;
+use askama::Template;
use serde::{Deserialize, Serialize};
use crate::bot::MasterBot;
@@ -41,6 +43,7 @@ pub async fn start(args: WebServerArgs) -> std::io::Result<()> {
.service(api::get_bot_list)
.service(api::get_bot),
)
+ .service(web::scope("/docs").service(get_api_docs))
.service(actix_files::Files::new("/static", "static/"))
})
.bind(args.bind_address)?
@@ -93,6 +96,15 @@ async fn get_bot(
}
}
+#[derive(Template)]
+#[template(path = "docs/api.htm")]
+struct ApiDocsTemplate;
+
+#[get("/api")]
+async fn get_api_docs() -> impl Responder {
+ ApiDocsTemplate.into_response()
+}
+
mod filters {
use std::time::Duration;