Service

    The relationship between Routes and a Service is usually N:1 as shown in the image below.

    As shown, different Routes could be bound to the same Service. This reduces redundancy as these bounded Routes will have the same and Plugin configurations.

    Examples

    We can also specify different Plugins or Upstream for the Routes than the ones defined in the Service. The example below creates a Route with a limit-count Plugin. This Route will continue to use the other configurations defined in the Service (here, the Upstream configuration).

    1. curl http://127.0.0.1:9080/apisix/admin/routes/102 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
    2. {
    3. "service_id": "200",
    4. "plugins": {
    5. "limit-count": {
    6. "count": 2000,
    7. "rejected_code": 503,
    8. "key": "remote_addr"
    9. }
    10. }
    note