refactor: restructure server routing and add documentation routes

This commit is contained in:
Andrew Phillips
2025-08-12 15:01:38 -03:00
committed by Andrew Phillips (aider)
parent 4c82c55f58
commit 6869b08a77
2 changed files with 8 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ async fn run_server(
args: Arc::new(args.clone()), args: Arc::new(args.clone()),
}; };
let app = api::api_router() let app = Router::new()
.layer(axum::middleware::from_fn(logging_middleware)) .layer(axum::middleware::from_fn(logging_middleware))
.layer( .layer(
ServiceBuilder::new() ServiceBuilder::new()

View File

@@ -81,3 +81,10 @@ pub async fn handle_swagger_ui() -> Html<&'static str> {
Html(html) Html(html)
} }
pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
router
// Documentation endpoints
.route("/openapi.json", get(docs::handle_openapi))
.route("/swagger/", get(docs::handle_swagger_ui))
}