Create Route for HTTPBIN Service
Now we have created the HTTPBIN service successfully, specifying the upstream URL. But we don't have any routes.
In this section, we'll create a route that returns a JSON string from https://httpbin.org. To create such a route, do the following steps:
- Open the API7 Cloud console.
- From the left navigation bar, choose API Management, then select Services from the secondary menu.
- Click on the name of the HTTPBIN service.
- On the service details page, click on the Create Route
- Fill the form to create the target route.
- Set the Path field to
/json
. - Select the Strip Path Prefix option, which means the
/v1/json
will be rewritten to "/json" before proxying to the backend; - Only allow
GET
method.
- Set the Path field to
Congratulations! You have created the JSON route. Now, let's send some requests to verify if it works!