How to nest scopes? #2539
Answered
by
aliemjay
cupcakearmy
asked this question in
Q&A
How to nest scopes?
#2539
-
I'm trying some stuff out and can't get nested scopes to work. What am I missing? pub fn init(cfg: &mut web::ServiceConfig) {
cfg.service(
web::scope("/api/")
.service(
web::scope("/sub/")
.service(one)
.service(two)
.service(three),
)
.service(four),
);
} |
Beta Was this translation helpful? Give feedback.
Answered by
aliemjay
Dec 22, 2021
Replies: 1 comment 1 reply
-
You need to remove the trailing slash in scopes. Currently it only matches |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cupcakearmy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to remove the trailing slash in scopes. Currently it only matches
/api//sub//other_routes
.See https://docs.rs/actix-web/4.0.0-beta.15/actix_web/dev/struct.ResourceDef.html#pattern-format-and-matching-behavior .