Routes
In this document, you will learn the basic concept of service routes in API7 Enterprise Edition, different service routing options API7 Enterprise Edition offers, as well as drawbacks and solutions to repetitive service route configurations.
Overview
Service routes define paths to upstream services. In API7 Enterprise Edition, a service route is responsible for matching client requests based on configured rules, loading and executing the corresponding plugins, and forwarding requests to the specified upstream service endpoints.
A simple service route can be set up with a path-matching URI and a corresponding upstream address. The diagram below shows an example of users sending two HTTP requests to the API7 Enterprise Edition API gateway, which are forwarded accordingly per the configured rules in service routes:
Service routes are often configured with plugins as well. For example, configuring the rate-limit plugin in a route will enable rate-limiting effects.
Services, Routes, and Upstreams
While service routes are essential in defining the paths of traffic flows, there are drawbacks to repetitive service route configurations (i.e. hard coding the same service upstream addresses or plugin names for a group of service routes). During the time of updates, the repetitive field(s) of these routes will need to be traversed and updated one by one. Configurations like this increase a lot of maintenance costs as a result, especially in large-scale systems with many service routes.
To address this issue, Services and Service Upstream were designed to abstract away repetitive information and reduce redundancies, following the DRY principle.