use axum::{ http::{header, HeaderMap, HeaderValue, StatusCode}, response::IntoResponse, }; use crate::util::response::ApiErr; pub async fn get_api_md() -> Result { let content = tokio::fs::read_to_string("API.md") .await .map_err(|err| { tracing::error!("Failed to read API.md: {}", err); ApiErr::NotFound("API.md not found".to_string(), None) })?; let mut headers = HeaderMap::new(); headers.insert( header::CONTENT_TYPE, HeaderValue::from_static("text/markdown; charset=utf-8"), ); Ok((StatusCode::OK, headers, content)) } pub async fn get_readme_md() -> Result { let content = tokio::fs::read_to_string("README.md") .await .map_err(|err| { tracing::error!("Failed to read README.md: {}", err); ApiErr::NotFound("README.md not found".to_string(), None) })?; let mut headers = HeaderMap::new(); headers.insert( header::CONTENT_TYPE, HeaderValue::from_static("text/markdown; charset=utf-8"), ); Ok((StatusCode::OK, headers, content)) }