Tutorial: How to Build Your First Node.js gRPC API

What is gRPC?

Google Remote Procedure Call (gRPC) is a remote procedure call framework that eases the communication process between client and server applications. It’s high-performing, robust, and lightweight.

These three qualities are due to its data exchange format and the interface definition language used by protocol buffers (protobufs). Protobufs are small and fast due to their data serialization format, which enables smaller packets. This makes them highly suitable for fast data flow and economical storage.

Before building the application program interface (API), it’s important to understand the features that give gRPC an upper hand over other API technologies like REST and GraphQL.

What are the features of gRPC?

The distinguishing features of gRPC are:

The use of protobufs. Developers must follow a specific format in defining the protobufs. This enforcement plays a significant role in clean code and error reduction. The presence of a compiler (protoc) to perform data serialization and deserialization. The protoc does this using automatic code generation that handles the functionality. This relieves developers from the overhead of parsing JSON or XML. The reduction of errors and increased efficiency because the protoc compiler parses the data. Developers only focus on other parts of the logic. gRPC uses HTTP/2, which is faster than HTTP/1 used by other technologies. Specifically, gRPC supports bidirectional streaming, enabling the multiplexed forms of communication between systems.

This article will demonstrate how to develop a basic Node.js gRPC API that salts and hashes a password received

Read more

Explore the site

More from the blog

Latest News