In this article, we will learn how microservices interact with each other using the gRPC framework. gRPC is a modern RPC that enables microservices to interact with each other.

What is a microservice?

A microservice is an architecture that splits the server application into loosely coupled services. for example:

  1. A microservice that is dedicated to user authentication and authorization.
  2. A microservice for handling customers’ details (getting, updating, inserting Etc.)
  3. A microservice for handling products.
  4. A microservice for handling orders.
  5. The list goes on.

A more detailed explanation about microservices can be found at  https://en.wikipedia.org/wiki/Microservices

These microservices often need to interact with each other. For example, The orders microservice often needs to have product details and some customer’s details.

The products and the orders microservices often need to interact with the user’s microservice to know whether the users are authorized to perform certain actions like Adding products or confirming orders.

There are several methods that define how Microservices interact with each other. The most commonly used are:

  1. SOAP
  2. HTTP REST architecture
  3. GraphQL

In this article, we will focus on a newer protocol which is known as gRPC. Unlike older protocols, this protocol is based on the HTTP 2.0 protocol.

#javascript #programming #nodejs #grpc

How Node.js Microservices interact with Each Other using gRPC
1.25 GEEK