Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
dynamic_codegen/ | 03-May-2024 | - | 1,193 | 963 | ||
static_codegen/ | 03-May-2024 | - | 2,761 | 1,744 | ||
.gitignore | D | 03-May-2024 | 29 | 3 | 3 | |
README.md | D | 03-May-2024 | 1.3 KiB | 51 | 37 | |
package.json | D | 03-May-2024 | 241 | 13 | 12 |
README.md
1gRPC in 3 minutes (Node.js) 2=========================== 3 4PREREQUISITES 5------------- 6 7- `node`: This requires Node 0.12.x or greater. 8 9INSTALL 10------- 11 12 ```sh 13 $ # Get the gRPC repository 14 $ export REPO_ROOT=grpc # REPO root can be any directory of your choice 15 $ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc $REPO_ROOT 16 $ cd $REPO_ROOT 17 18 $ cd examples/node 19 $ npm install 20 ``` 21 22TRY IT! 23------- 24 25There are two ways to generate the code needed to work with protocol buffers in Node.js - one approach uses [Protobuf.js](https://github.com/dcodeIO/ProtoBuf.js/) to dynamically generate the code at runtime, the other uses code statically generated using the protocol buffer compiler `protoc`. The examples behave identically, and either server can be used with either client. 26 27 - Run the server 28 29 ```sh 30 $ # from this directory 31 $ node ./dynamic_codegen/greeter_server.js & 32 $ # OR 33 $ node ./static_codegen/greeter_server.js & 34 ``` 35 36 - Run the client 37 38 ```sh 39 $ # from this directory 40 $ node ./dynamic_codegen/greeter_client.js 41 $ # OR 42 $ node ./static_codegen/greeter_client.js 43 ``` 44 45TUTORIAL 46-------- 47You can find a more detailed tutorial in [gRPC Basics: Node.js][] 48 49[Install gRPC Node]:../../src/node 50[gRPC Basics: Node.js]:https://grpc.io/docs/tutorials/basic/node.html 51