1.7 KiB
| title | layout | aliases | |
|---|---|---|---|
| Web Quick Start | quickstart |
|
This guide gets you started with gRPC-Web with a simple working example from the browser.
Prerequisites
dockeranddocker-compose
This demo requires Docker Compose file version 3. Please refer to Docker website on how to install Docker.
Run an Echo example from the browser!
$ git clone https://github.com/grpc/grpc-web
$ cd grpc-web
$ docker-compose pull
$ docker-compose up -d node-server envoy commonjs-client
Open a browser tab, and go to:
http://localhost:8081/echotest.html
To shutdown, run docker-compose down.
What is Happening?
In this demo, there are three key components:
-
node-server: This is a standard gRPC Server, implemented in Node. This server listens at port:9090and implements the service's business logic. -
envoy: This is the Envoy proxy. It listens at:8080and forwards the browser's gRPC-Web requests to port:9090. This is done via a config fileenvoy.yaml. -
commonjs-client: This component generates the client stub class using theprotoc-gen-grpc-webprotoc plugin, compiles all the JS dependencies usingwebpack, and hosts the static contentechotest.htmlanddist/main.jsusing a simple web server at port:8081. Once the user interacts with the webpage, it sends a gRPC-Web request to the Envoy proxy endpoint at:8080.
What's next
- Work through a more detailed tutorial in gRPC Basics: Web