Home / Companies / LogRocket / Blog / Post Details
Content Deep Dive

An all-in-one guide to gRPC-Gateway

Blog post from LogRocket

Post Details
Company
Date Published
Author
Anshul Goyal
Word Count
3,732
Language
-
Hacker News Points
-
Summary

gRPC-Gateway is a plugin for protoc that facilitates the creation of a reverse proxy server to convert Restful/JSON requests into gRPC and vice versa, enabling legacy and web clients that may not support gRPC to interact with gRPC services. It is highly customizable and can be used as a standalone server or integrated into an existing codebase, generating Go code from Protocol Buffer definitions. This tool allows for the same codebase to support both Restful/JSON and gRPC, which can be particularly useful in cases where browsers or older clients require a Restful/JSON interface. The gRPC-Gateway is also capable of generating open API documentation and can be scaled horizontally to run on multiple machines, typically employing a load balancer for efficient handling. It supports error handling, logging, and customization of HTTP headers and response formats, and can be integrated with popular frameworks like Gin for additional routing capabilities. Furthermore, it is possible to run both reverse proxy and gRPC services on the same port using the cmux package, which distinguishes between HTTP1 and HTTP2 traffic.