hi i have a question about contracts. it is pretty easy to nest routes with the normal router, but i'm not sure what syntax to use to nest contracts (ie: all endpoints share the same path segment). example (not working):
Copy code
"/tokens" bind contract {
routes += TokenID.path bind contract {
routes += "/" bindContract GET to ::getToken
routes += "/" bindContract GET to ::getToken
routes += "/" bindContract PUT to ::putToken
routes += "/" bindContract DELETE to ::removeToken
routes += "/user" bindContract GET to ::getUser
}
}
d
dave
03/18/2022, 3:25 PM
it is more limited than the standard routing. you can't actually nest contracts in the same way, although you can nest an entire contact inside a routes block. each contract route needs to be qualified separately
m
Marc
03/18/2022, 3:56 PM
as a sample, how would you model something like this?
consider the route hierachy /tokens/{id}, /tokens/{id}/user
m
Martin Gaens
04/11/2023, 11:33 PM
Has this changed or is there still no way to nest ContractRoutes?
d
dave
04/12/2023, 2:10 AM
No change 🙃 - you still need to model each route separately