Route the request to another destination according to the configured routing rules. Each routing rule includes a condition, a customized request, a destination, and a customized response.
Routing stage evaluates the routing rules by using the
if...else if...else statement, like the following pseudo-code:
if condition 1 is true if pre-destination transformation exists do the transformation get the data from the destination if post-destination transformation exists do the transformation else if condition 2 is true ... ... else get the data from the default destination
Note: A Microflow® application can contain only one Routing stage at the end of the request flow.
Routing stage contains the following fields:
|Condition||A condition expression is evaluated against the
|Destination||A relative URL or an absolute URL of the destination. If a relative URL is provided, the original host, port, and protocol information is used to process the request. For example, if
Note: Destinations that are a redirect are not supported. For example, if you use
The following sample code shows how to add a new status
all to the
GET/pet/findByStatus operation of the Petstore sample and redirect the
pet/findByStatus?status=all request to
req.query.status && /all/.test(req.query.status)
After pushing the configured stage and running the Microflow application, query
<Microflow endpoint>/pet/findByStatus?status=all, the result is the same as querying