1use axum::Router;
2
3use crate::{ApiError, HttpOptions, middleware::layers};
4
5pub fn finalize<S>(router: Router<S>, options: HttpOptions) -> Router<S>
11where
12 S: Clone + Send + Sync + 'static,
13{
14 layers(
15 router
16 .fallback(route_not_found)
17 .method_not_allowed_fallback(method_not_allowed),
18 options,
19 )
20}
21
22async fn route_not_found() -> ApiError {
23 ApiError::not_found("Route not found")
24}
25
26async fn method_not_allowed() -> ApiError {
27 ApiError::method_not_allowed()
28}