mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Allow Routers to inherit state (#1368)
* Rename Fallback::Custom to Fallback::Service
* Allow Routers to inherit state
* Rename Router::{nest => nest_service} and add new nest method for Routers
* Fix lints
* Add basic tests for state inheritance
* Changelog
This commit is contained in:
@@ -149,7 +149,7 @@ impl<B, T, F> SpaRouter<B, T, F> {
|
||||
|
||||
impl<B, F, T> From<SpaRouter<B, T, F>> for Router<(), B>
|
||||
where
|
||||
F: Clone + Send + 'static,
|
||||
F: Clone + Send + Sync + 'static,
|
||||
HandleError<Route<B, io::Error>, F, T>: Service<Request<B>, Error = Infallible>,
|
||||
<HandleError<Route<B, io::Error>, F, T> as Service<Request<B>>>::Response: IntoResponse + Send,
|
||||
<HandleError<Route<B, io::Error>, F, T> as Service<Request<B>>>::Future: Send,
|
||||
@@ -161,7 +161,7 @@ where
|
||||
.handle_error(spa.handle_error.clone());
|
||||
|
||||
Router::new()
|
||||
.nest(&spa.paths.assets_path, assets_service)
|
||||
.nest_service(&spa.paths.assets_path, assets_service)
|
||||
.fallback_service(
|
||||
get_service(ServeFile::new(&spa.paths.index_file)).handle_error(spa.handle_error),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user