Add Quickstart and Tutorial for gRPC-Web#737
Conversation
| <p class="lead">This guide gets you started with gRPC-Web with a simple | ||
| working example from the browser.</p> | ||
|
|
||
| <div id="toc"></div> |
There was a problem hiding this comment.
I am not sure why it's there but it's in every docs/quickstart/<lang>.md. We could probably remove all of them in one separate PR.
docs/quickstart/web.md
Outdated
|
|
||
| * `docker` and `docker-compose` | ||
|
|
||
| Please refer to [Docker website][] on how to install Docker. |
There was a problem hiding this comment.
Yes, the link is at the bottom. I tested that out.
docs/tutorials/basic/web.md
Outdated
| The first step when creating a gRPC service is to define the service methods | ||
| and their request and response message types using protocol buffers. In this | ||
| example, we define our `EchoService` in a file called | ||
| [`echo.proto`](https://github.com/grpc/grpc-web/blob/master/net/grpc/gateway/examples/echo/echo.proto). |
There was a problem hiding this comment.
consider pinning to a particular version instead of master, in case the files move.
| listeners: | ||
| - name: listener_0 | ||
| address: | ||
| socket_address: { address: 0.0.0.0, port_value: 8080 } |
There was a problem hiding this comment.
In the future, I think there is a DNS plugin for Envoy that let's you bind to localhost.
There was a problem hiding this comment.
Will keep that in mind, thanks!
| listeners: | ||
| - name: listener_0 | ||
| address: | ||
| socket_address: { address: 0.0.0.0, port_value: 8080 } |
There was a problem hiding this comment.
How come the quickstart uses 8081, but this uses 8080?
There was a problem hiding this comment.
So :8080 is where Envoy listens at. :8081 is where the static content (.html, .js) was hosted.
So the user requests static content (.html, .js) from :8081. Doing a "grpc-web" action will make a request to Envoy, which listens at :8080. I kind of deliberately do this to illustrate how users can add CORS setup to their envoy config. I believe it's quite common that users may have their static content hosted from one domain but make cross-origin request to another domain to their APIs.
|
@hsaliak ping. |
|
/cc |
docs/quickstart/web.md
Outdated
|
|
||
| To shutdown, run `docker-compose down`. | ||
|
|
||
| ## Install the gRPC-Web protoc plugin |
There was a problem hiding this comment.
This section seems out of place, If the gRPC-Web protoc plugin is covered in the basic tutorial, then we can remove this section from here.
|
@hsaliak Please review, thanks. |
|
The corresponding PR in grpc-web to add the actual Node server is here: grpc/grpc-web#302 |
hsaliak
left a comment
There was a problem hiding this comment.
Looks great! Lets ship this. Thank you and apologies for the delay @stanley-cheung
Add Quickstart and Tutorial for gRPC-Web to main grpc.io website
cc: @wenbozhu