Could layer
in one of router be used in other router after merge
?
#1867
-
The router structure is below
In let route = Router::new()
.route("/admin", get(admin_handler))
.route_layer(RequireAuthorizationLayer::<User, Role>::login_with_role(
Role::Admin..,
))
.route("/", get(protected_handler))
.route_layer(RequireAuthorizationLayer::<User, Role>::login());
route
.merge(sign_up::create_router().await)
.merge(patient::create_router().await)
.merge(auth::create_router().await) The auth is completed in
Should I use other functions, instead of |
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Mar 20, 2023
Replies: 1 comment
-
Nope. Then you need to add the layer after merging: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Weijun-H
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nope. Then you need to add the layer after merging:
.merge(...).merge(...).layer(...)