7. Defining child resources
Sometimes your resource types will need to have child resources that relate to their parent types. You can identify that a resource type is the child of another resource by using the @parentResource
decorator.
For example, hereβs how you could create a new WidgetPart
resource under the Widget
defined above:
When you use the standard resource operations with child resource types, their operation routes will include the route of the parent resource. For example, we might define the following operations for WidgetPart
:
These operations will be defined under the route path: