You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm proposing to support the following style so that we can have a chain of controllers to fulfill a hierarchical REST request.
@api({basePath: '/customers',paths: {})classCustomerController{
@locate('{customerId}/orders')locateOrder(@param.path.string('customerId')customerId: string){letorder: OrderController= ...;// Instantiated, injected, or located from the contextreturnorder;// Return an instance of OrderController}}
When the router sees requests like GET /customers/{customerId}/orders or PATCH /customers/{customerId}/orders/{orderId}, it first checks if there are exact matches in controller methods that handle the verb and url. If no matches are found, the router will try to find a matching locate method (no http verb but with a path). In the example above, locateOrder method will be invoked and the returned controller instance will be used to further resolve/fulfill the rest of the URL such as GET / or PATCH /{id}.
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.
Description/Steps to reproduce
REST APIs sometimes represent hierarchical resources, for example:
For controllers, we can decorate methods to map to resource operations, for example
I'm proposing to support the following style so that we can have a chain of controllers to fulfill a hierarchical REST request.
When the router sees requests like
GET /customers/{customerId}/orders
orPATCH /customers/{customerId}/orders/{orderId}
, it first checks if there are exact matches in controller methods that handle the verb and url. If no matches are found, the router will try to find a matchinglocate
method (no http verb but with a path). In the example above,locateOrder
method will be invoked and the returned controller instance will be used to further resolve/fulfill the rest of the URL such asGET /
orPATCH /{id}
.Prior arts
Additional information
The text was updated successfully, but these errors were encountered: