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:
Jonas Platte
2022-09-25 11:56:23 +00:00
committed by GitHub
parent 2077d50021
commit 4847d681b1
17 changed files with 453 additions and 225 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ async fn main() {
)
.route("/keys", get(list_keys))
// Nest our admin routes under `/admin`
.nest("/admin", admin_routes(shared_state).into_service())
.nest("/admin", admin_routes(shared_state))
// Add middleware to all routes
.layer(
ServiceBuilder::new()