24 lines
652 B
Rust
24 lines
652 B
Rust
use axum::{Router, Json};
|
|
use utoipa::OpenApi;
|
|
use utoipa_swagger_ui::SwaggerUi;
|
|
use crate::modes::server::AppState;
|
|
|
|
#[derive(OpenApi)]
|
|
#[openapi(
|
|
info(
|
|
title = "Keep API",
|
|
version = "0.1.0",
|
|
description = "Keep and manage temporary files with automatic compression and metadata generation"
|
|
)
|
|
)]
|
|
struct ApiDoc;
|
|
|
|
pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
|
|
router
|
|
// Documentation endpoints
|
|
.merge(SwaggerUi::new("/swagger").url("/openapi.json", ApiDoc::openapi()))
|
|
.route("/openapi.json", axum::routing::get(|| async {
|
|
Json(ApiDoc::openapi())
|
|
}))
|
|
}
|