What is an API Gateway?
An API Gateway is the central entry point for all requests to a microservices system. It accepts requests from clients and routes them to the needed services, hiding the internal structure of the system.
The main tasks of an API Gateway:
- Routing - directs requests to the needed microservices (for example,
/users→ the users service,/orders→ the orders service). - Authentication and security - checks tokens and access rights, and filters unwanted requests.
- Data aggregation - combines responses from several services into one (for example, a profile plus orders).
- Caching and load balancing - reduces the load on the microservices and distributes traffic evenly.
- Logging and monitoring - collects statistics and request metrics.
Example
A client application does not talk to a dozen different APIs, only to a single address: gateway.example.com. The gateway itself decides where to send the request and how to assemble the response.
Summary:
An API Gateway is a "facade" for a microservices system that simplifies access to many services, increases security, and allows traffic to be managed centrally.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.