项目作者: toransahu

项目描述 :
gRPC demonstration of uniary & bi-directional server-client communication
高级语言: Go
项目地址: git://github.com/toransahu/grpc-eg-go.git
创建时间: 2019-07-18T17:25:13Z
项目社区:https://github.com/toransahu/grpc-eg-go

开源协议:

下载


This is basic example of gRPC based microservice to serve a Virtual Stack Machine over HTTP2.0 network.

Pre-requisites

  1. # install protobuf compiler
  2. ~/grpc-eg-go
  3. $ go get -u -v github.com/golang/protobuf/{proto,protoc-gen-go}
  4. # install grpc
  5. ~/grpc-eg-go
  6. $ go get -u -v google.golang.org/grpc

Generate Go Source Code from Protobuf

  1. ~/grpc-eg-go
  2. $ SRC_DIR=./
  3. $ DST_DIR=$SRC_DIR
  4. $ protoc -I=$SRC_DIR --go_out=plugins=grpc:$DST_DIR $SRC_DIR/machine/machine.proto

Run

  1. ~/grpc-eg-go
  2. $ go run cmd/run_machine_server.go
  3. $ go run client/machine.go