How to configure nested paths with IDs #3012
-
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 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Fixed. My function signature was wrong |
Beta Was this translation helpful? Give feedback.
Fixed. My function signature was wrong