Files
keep/src/modes/server/docs.rs
Andrew Phillips 4d3a9fd3ac fix: resolve compilation errors by adding missing imports and fixing schema definitions
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-08-12 16:58:29 -03:00

37 lines
982 B
Rust

use axum::response::Html;
use axum::Router;
use axum::routing::get;
use crate::modes::server::AppState;
pub async fn handle_swagger_ui() -> Html<&'static str> {
let html = r#"<!DOCTYPE html>
<html>
<head>
<title>Keep API Documentation</title>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3.52.5/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@3.52.5/swagger-ui-bundle.js"></script>
<script>
SwaggerUIBundle({
url: '/api-docs/openapi.json',
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.presets.standalone
]
});
</script>
</body>
</html>"#;
Html(html)
}
pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
router
// Documentation endpoints
.route("/swagger", get(handle_swagger_ui))
}