Function any_service
fn any_service<T, S>(svc: T) -> MethodRouter<S, <T as >::Error>
where
T: Service<axum_core::extract::Request> + Clone + Send + Sync + 'static,
<T as >::Response: IntoResponse + 'static,
<T as >::Future: Send + 'static,
S: Clone
Route requests to the given service regardless of its method.
Example
use ;
use Response;
use Infallible;
let service = service_fn;
// All requests to `/` will go to `service`.
let app = new.route;
# let _: Router = app;
Additional methods can still be chained:
use ;
use Response;
use Infallible;
let service = service_fn;
let other_service = service_fn;
// `POST /` goes to `other_service`. All other requests go to `service`
let app = new.route;
# let _: Router = app;