Dawid Wysokiński c9ffd5e508 | ||
---|---|---|
certs | ||
cmd | ||
internal/greeter | ||
proto | ||
.gitignore | ||
.golangci.yml | ||
README.md | ||
go.mod | ||
go.sum |
README.md
gRPC - demo
How to run it locally?
Prerequisites:
- Go 1.19+
- protoc
- Go plugins for the protocol compiler:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
- Clone this repo.
cd ./grpc-demo
- Run
go generate ./...
. - Compile and execute the server code -
go run ./cmd/server/main.go
. - From a different terminal, compile and execute the client code -
go run ./cmd/client/main.go -example unary
.
Client - available examples
- unary - example of the simplest type of RPC where the client sends a single request and gets back a single response. It's the default one.
- server - example of server streaming RPC.
- client - example of client streaming RPC.
- bidirectional - example of bidirectional streaming RPC.
- james - SayHelloToJames without error
- jameserror - error handling