I have a backend API with 100 methods/resources. In my Mule API in front of this, I want to transform the payload for only 2 of these resources before passing the request to my backend API. For the rest of my resources, I simply want to pass through the request to the backend.
Is it possible to do this with APIkit router without having to create 98 separate flows for each of the pass through resources? Can the 98 resources be handled in a default type way of routing?
Yes, it is possible to handle the 98 pass-through resources in a default way using APIkit Router.
One way to achieve this is to use the APIkit Router with a catch-all routing strategy. You can create a single flow that handles the payload transformation for the 2 specific resources, and then use the APIkit Router's catch-all routing strategy to route all other requests to the backend API.
Here's an example of how you can configure the APIkit Router to handle the pass-through resources:
<apikit:router config-ref="APIkit_config" >
<apikit:router-entry catchAll="true" resource="your_backend_resource_name" target="pass-through-flow"/>
</apikit:router>
In this example, all requests that don't match any of the explicitly defined router-entry elements will be routed to the "pass-through-flow" flow, which can simply proxy the request to your backend API.
You can also use the "default-entry-point" attribute to route all requests that don't match any of the explicitly defined router-entry elements to a specific flow.
It's also important to note that you will need to add the catchAll attribute as true to all the resources other than the 2 resources for which you need to handle the payload transformation.