Suppose a company named XYZ developed an API for its internal purposes. There are two ways in which it exposes that API for external use:
- It exposes it using authentication from known clients.
- It exposes it as an API as a service.
In the first case, this API is consumed by the other services inside the company. Since they are internal, we don't restrict access. But in the second case, since the API details are given to the outside world, we need a broker in-between to check and validate the requests. This broker is the API Gateway. An API Gateway is a broker that sits in-between the client and the server and forwards the request to the server, on the passing of specific conditions.
Now, the company XYZ has an API written in Go and also in Java. There are a few common things that apply to any API:
- Authentication
- Logging of requests and responses...