use axum::{
extract::State,
response::{Html, Json},
};
use serde_json::json;
use crate::data::AppState;
pub async fn root_handler() -> Html<&'static str> {
Html(include_str!("../../web/static/index.html"))
}
pub async fn api_config_handler(State(state): State<AppState>) -> Json<serde_json::Value> {
Json(json!({
"title": state.document.title(),
"config": state.document.as_json(),
"message": "jkconfig Web API",
"version": "0.1.1"
}))
}
pub async fn health_check() -> Json<serde_json::Value> {
Json(json!({
"status": "ok",
"timestamp": chrono::Utc::now().to_rfc3339()
}))
}
pub async fn static_handler() -> Html<&'static str> {
Html(include_str!("../../web/static/index.html"))
}