This is a very basic example of how to implement a simple calcualtor service in gRPC that adds two numbers.
It's composed of:
/calcpb
: the protocol buffers package which contains the gRPC message and service definitions./server
: the gRPC server that performs the add operation./client
: the gRPC client which communicate with the server by sending a request and receiving a result of the add operation as a response.generate.sh
: a script to generate the protocol buffers go code from the.proto
file.
-
Clone the repo inside your
$GOPATH
. -
From the root of the project, install the required dependencies:
go get
- Run the server:
go run server/server.go
- Run the client:
go run client/client.go