Skip to main content

kova_api/
gui.rs

1//! The embedded GUI document and the health probe.
2
3use axum::http::{
4    header::{self, HeaderValue},
5    HeaderMap,
6};
7use axum::Json;
8use kova_gui::index_html;
9use serde_json::{json, Value};
10
11/// `GET /health` — liveness for the engine process.
12pub async fn health() -> Json<Value> {
13    Json(json!({
14        "status": "ok",
15        "service": "kova",
16        "version": env!("CARGO_PKG_VERSION"),
17    }))
18}
19
20/// `GET /` — the embedded GUI (see `kova-gui`).
21pub async fn index() -> (HeaderMap, String) {
22    let mut headers = HeaderMap::new();
23    headers.insert(
24        header::CONTENT_TYPE,
25        HeaderValue::from_static("text/html; charset=utf-8"),
26    );
27    (headers, index_html())
28}