Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical gRPC

You're reading from   Practical gRPC Build highly-connected systems with a framework that can run on any platform

Arrow left icon
Product type Paperback
Published in Nov 2019
Publisher
ISBN-13 9781839211744
Length 169 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (6):
Arrow left icon
Robert Ross Robert Ross
Author Profile Icon Robert Ross
Robert Ross
Carles Sistare Carles Sistare
Author Profile Icon Carles Sistare
Carles Sistare
Joshua B. Humphries Joshua B. Humphries
Author Profile Icon Joshua B. Humphries
Joshua B. Humphries
Backstop Media LLC Backstop Media LLC
Author Profile Icon Backstop Media LLC
Backstop Media LLC
David Konsumer David Konsumer
Author Profile Icon David Konsumer
David Konsumer
David Muto David Muto
Author Profile Icon David Muto
David Muto
+2 more Show less
Arrow right icon
View More author details
Toc

gRPC Gateway

The web over the last few years has been consistently moving to a Frontend > Backend model where the backend is nothing more than a JSON API that JavaScript in the browser uses to render the page. Since gRPC relies on HTTP/2 as the transport, this means browsers can’t hit a gRPC server directly.

Since gRPC uses well defined messages and services with the protobuf definition language, you can easily generate code from these definitions. Using a tool called “grpc-gateway” you can actually make a fully functional JSON server that forwards requests to a running gRPC server. It handles the transcoding of the provided JSON to gRPC and vise versa.

grpc-gateway-flow

From: https://github.com/grpc-ecosystem/grpc-gateway

Starting on the left, we define our protobufs and then generate a reverse proxy from them using the grpc-gateway tool. The tool will generate all of the endpoints in the protobuf’s “Service” definitions. From here, API clients (such as AJAX...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image