Home | History | Annotate | only in /external/grpc-grpc/examples/node
Up to higher level directory
NameDateSize
dynamic_codegen/22-Oct-2020
package.json22-Oct-2020241
README.md22-Oct-20201.3K
static_codegen/22-Oct-2020

README.md

      1 gRPC in 3 minutes (Node.js)
      2 ===========================
      3 
      4 PREREQUISITES
      5 -------------
      6 
      7 - `node`: This requires Node 0.12.x or greater.
      8 
      9 INSTALL
     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 
     22 TRY IT!
     23 -------
     24 
     25 There 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 
     45 TUTORIAL
     46 --------
     47 You 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