Files
keep/src/modes/server/docs.rs
Andrew Phillips 01b27fb61d fix: restore openapi.json endpoint and update swagger UI path reference
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-08-12 16:54:58 -03:00

34 lines
922 B
Rust

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: '/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("/openapi.json", get(handle_openapi))
.route("/swagger", get(handle_swagger_ui))
}