Skip to content

Latest commit

 

History

History

hello-grpc-nodejs

grpc nodejs demo

1 Setup

https://github.com/nodejs/release#release-schedule

npm config set registry https://registry.npmmirror.com
npm config get registry
npm install -g grpc-tools
# https://www.npmjs.com/package/protoc-gen-grpc
# https://www.npmjs.com/package/@grpc/grpc-js
npm install request -g
npm config set unsafe-perm true
npm install protoc-gen-grpc -g

2 Generate

sh proto2js.sh

3 Build

npm install

4 Run

node proto_server.js
node proto_client.js

UT

npm test

grpc/grpc-node#1974

export GRPC_HELLO_SECURE=Y
export GRPC_TRACE=subchannel
export GRPC_VERBOSITY=DEBUG

Diagnose

# find
lsof -i tcp:9996
# kill
kill $(lsof -ti:9996)

5 Automatically update package.json dependencies

  1. npm -g install npm-check-updates
  2. ncu to see outdated versions or ncu --upgrade to update the package.json.

Reference