refactor: restructure server routing and add documentation routes
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
4c82c55f58
commit
6869b08a77
@@ -59,7 +59,7 @@ async fn run_server(
|
||||
args: Arc::new(args.clone()),
|
||||
};
|
||||
|
||||
let app = api::api_router()
|
||||
let app = Router::new()
|
||||
.layer(axum::middleware::from_fn(logging_middleware))
|
||||
.layer(
|
||||
ServiceBuilder::new()
|
||||
|
||||
@@ -81,3 +81,10 @@ pub async fn handle_swagger_ui() -> Html<&'static str> {
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user