Expose API

    Upstream is a virtual host abstraction that performs load balancing on a given set of service nodes according to the configured rules.

    The role of the Upstream is to load balance the service nodes according to the configuration rules, and Upstream information can be directly configured to the Route or Service.

    When multiple routes or services refer to the same upstream, you can create an upstream object and use the upstream ID in the Route or Service to reference the upstream to reduce maintenance pressure.

    Routes match the client’s request based on defined rules, load and execute the corresponding plugins, and forwards the request to the specified Upstream.

    Please make sure you have before doing the following.

    1. Create an Upstream.

    Create an Upstream service containing that you can use for testing. This is a return service that will return the parameters we passed in the request.

    In this command, we specify the Admin API Key of Apache APISIX as edd1c9f034335f136f87ad84b625c8f1, use roundrobin as the load balancing mechanism, and set as the upstream service. To bind this upstream to a route, upstream_id needs to be set to 1 here. Here you can specify multiple upstreams under to achieve load balancing.

    For more information, please refer to .

    1. Create a Route.
    note
    1. Test

    After creating the Route, you can test the Service with the following command:

    APISIX will forward the request to http://httpbin.org:80/anything/foo?arg=10.

    You can refer to Protect API to protect your API.

    You can also use APISIX’s to achieve more functions.