What is API Gateway Design Pattern?
Previously we saw about What is Microservice? and the principles followed while developing MSA and the available design patterns. also we saw an Aggregator design pattern.
Today we will see what is API Gateway Design Pattern is.
What is API Gateway Design Pattern?
Microservice is built in such a way that each service acts differently on its own. So, when a web application is drilled down into smaller pieces there could be problems we face.
The problems are as follows.
- How to get data from various microservices?
- A different front-end application is required to manage the same database, just that it uses multiple web services.
- How to respond with the data for different consumer to satisfy their requirement. So that we can have reusable microservices.
- Handle multiple protocol requests.
Seems the list is small here, but in reality, it is even wider. The solution for these problems is to use the API Gateway design pattern. The API Gateway design pattern addresses many other problems apart from the ones mentioned above. We can also use this design pattern as a proxy service for routing the request.
API Gateway acts as the entry point for all the endpoints of the microservice, it can help in converting the various protocol request from one type to another. Also, it can disburden the responsibility of authentication/authorization in the microservice.
So, once the client sends the request, requests are passed through the API gateway which manages the entry point and re-routes the client’s request to the appropriate microservice. Then with the help of the load balancer, it distributes the client’s request to the microservice.
Microservice uses the service discovery which maintains the available microservices and their available entry points to communicate with each other

WeCanCode-Author
November 06, 2021
Senior Developer | Java & C#.NET | 10++ years of IT experience.
Planning to learn ReactJS or Angular or Flutter.!