Split Node examples into static and dynamic code generation examples#6431
Split Node examples into static and dynamic code generation examples#6431jtattermusch merged 2 commits intogrpc:masterfrom
Conversation
examples/node/README.md
Outdated
| TRY IT! | ||
| ------- | ||
|
|
||
| There are two variants of these examples: one with code dynamically generated at runtime using Protobuf.js and one with code statically generated using `protoc`. The examples behave identically, and either server can be used with either client. |
There was a problem hiding this comment.
Can we link to Protobuf.js, just in case the user is interested?
There was a problem hiding this comment.
Maybe add an additional sentence at the start here and restructure slightly:
There are two ways to generate the code needed to work with protocol buffers in Node.js - one approach uses Protobuf.js to dynamically generate the code at runtime, the other uses code statically generated using the protocol buffer compiler protoc. Because of this, there are two variants of these examples, one using dynamically generated code, one using statically generated code. The examples behave...
There was a problem hiding this comment.
I've put that suggested text into the README and linked Protobuf.js
|
Doc updates in this look good with a couple of minor tweaks. We'll also need to make similar updates to the Overview and Node tutorial in grpc.io. I can do that if you like? |
|
Just in terms of the tutorial, are there particular advantages and disadvantages for each approach (convenience vs. efficiency, that sort of thing?). And will we be supporting both versions as an ongoing thing? |
|
Also this means we need to provide instructions for installing/building protoc for Node, plus getting the plugin - what does the user need to do? |
|
If you could make the relevant changes to grpc.io, that would be great. The main advantages of dynamic code generation are ease-of-use and a simpler message API. The main advantages of static code generation are type safety and a message API that is similar to the ones in other languages. I think we want to support both options at least through the 1.0 release. @jayantkolhe Do you have an idea more specifically how long we want to support both options? For protoc and the plugin, along with the next release we will be publishing a package in each language that contains pre-built executables for protoc and the plugin. So, in Node, getting both of those will be as simple as running |
|
Docs here LGTM, I'll open a new issue for the grpc.io updates. |
|
"For protoc and the plugin, along with the next release we will be publishing a package in each language that contains pre-built executables for protoc and the plugin. So, in Node, getting both of those will be as simple as running npm install grpc-tools." That sounds great - should I hold off on updating grpc.io until we have that ready (I'm already not going to merge anything in until this PR is in, as I'll be pointing to the updated examples)? Or do we have interim instructions for building and installing, as in most of the other languages? |
|
That release will coincide with this feature becoming available, so it is not necessary to have interim instructions. |
|
Tutorial update is grpc/grpc.github.io#197 |
Now that we have two different ways of loading the information from
.protofiles for use in gRPC (#5418), this splits the examples to illustrate both.@LisaFC I tried to update the documentation to match the changes, but I'm not sure about what I wrote and I could use some help. I can also easily change the directory structure I made if a different one would work better.