How to configure nested paths with IDs #3012
Answered
by
seguidor777
seguidor777
asked this question in
Q&A
|
Hello I'm trying to create some nested paths/routes under the path /v1/branches/{branch_id} I have the following code: web::scope("/{branch_id}/users")
.route("", web::post().to(create_user))
.route("", web::get().to(index_users))
.route("/{user_id}", web::get().to(show_user))
.route("/{user_id}", web::put().to(update_user))
.route("/{user_id}", web::delete().to(delete_user))We can see the nested resource is users. However this is not working because the scope method is expecting to receive the user_id param as well, but I cannot put it there since it's not used in all the routes. When I try to access a URL like /v1/branches/123/users/456 I got error Can anyone please guide me to set this up correctly or share any useful example? Thanks |
Answered by
seguidor777
Apr 17, 2023
Replies: 1 comment
|
Fixed. My function signature was wrong |
0 replies
Answer selected by
robjtede
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed. My function signature was wrong