Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Add Quickstart and Tutorial for gRPC-Web#737

Merged
stanley-cheung merged 4 commits intogrpc:masterfrom
stanley-cheung:add-web-tutorial
Oct 8, 2018
Merged

Add Quickstart and Tutorial for gRPC-Web#737
stanley-cheung merged 4 commits intogrpc:masterfrom
stanley-cheung:add-web-tutorial

Conversation

@stanley-cheung
Copy link
Copy Markdown

@stanley-cheung stanley-cheung commented Sep 7, 2018

Add Quickstart and Tutorial for gRPC-Web to main grpc.io website

cc: @wenbozhu

Copy link
Copy Markdown

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

<p class="lead">This guide gets you started with gRPC-Web with a simple
working example from the browser.</p>

<div id="toc"></div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


* `docker` and `docker-compose`

Please refer to [Docker website][] on how to install Docker.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this valid markdown?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the link is at the bottom. I tested that out.

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).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider pinning to a particular version instead of master, in case the files move.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, I think there is a DNS plugin for Envoy that let's you bind to localhost.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will keep that in mind, thanks!

listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come the quickstart uses 8081, but this uses 8080?

Copy link
Copy Markdown
Author

@stanley-cheung stanley-cheung Sep 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@carl-mastrangelo
Copy link
Copy Markdown

@hsaliak ping.

@idvoretskyi
Copy link
Copy Markdown

/cc


To shutdown, run `docker-compose down`.

## Install the gRPC-Web protoc plugin
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@stanley-cheung
Copy link
Copy Markdown
Author

@hsaliak Please review, thanks.

@stanley-cheung
Copy link
Copy Markdown
Author

The corresponding PR in grpc-web to add the actual Node server is here: grpc/grpc-web#302

Copy link
Copy Markdown

@hsaliak hsaliak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Lets ship this. Thank you and apologies for the delay @stanley-cheung

@stanley-cheung stanley-cheung merged commit 4970499 into grpc:master Oct 8, 2018
@stanley-cheung stanley-cheung deleted the add-web-tutorial branch October 23, 2018 04:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants