Introduction to API Gateway

ashraful

Mohamad Ashraful Islam

Posted on February 7, 2021

Introduction to API Gateway

Originally posted on Ashraful's Blog

đź’ˇ What is an API Gatewayâť“

An API gateway is an API management tool that sits between a client and a collection of backend services.

An API gateway acts as a reverse proxy to accept all application programming interface (API) calls, aggregate the various services required to fulfill them, and return the appropriate result.
In short: An API Gateway is the abstraction layer between client and microservices.

🔥 When to use an API Gateway❓

Let's imagine that you are building a native mobile application for android and ios. In that case, you have two teams to develop the apps. On the backend side, you have separate services like Auth, Product, Cart, Order, etc. And you perfectly deploy the services. Let's assume the following IPs are assigned to services.

Auth     192.168.1.10
Product  192.168.1.11
Cart     192.168.1.12
Order    192.168.1.13
Enter fullscreen mode Exit fullscreen mode

Now you tell your app team to call API according to the services' IP/Domain. Okay Good. Your business is good.

After some days you realized to separate the Order and Payment service. Your backend team finished the job. And now the painful part is releasing the app(Android, iOS) and make sure that everyone gets the update. Both teams need to work just to change the API URL. Not only that, problems like this can arise at any time. So, here is a simple solution is, "API Gateway".

🎉 How an API Gateway is solving your problem❓

We just talk about the problem. Now let's talk about the solution. We just need to check the request URI and pass the request to the respected service. For example:

# Something like this.
if request_uri == '/api/login/':
   pass_the_request(auth_service)
Enter fullscreen mode Exit fullscreen mode

There are lots of API gateways that are already written for multiple purposes. For a small project, I'd like to use Nginx's reverse proxy. We'll talk about it later.

đź’– đź’Ş đź™… đźš©
ashraful
Mohamad Ashraful Islam

Posted on February 7, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Introduction to API Gateway
microservices Introduction to API Gateway

February 7, 2021