With Docker:
docker compose up -d
With Air:
-
Copy
example.env
to.env
and customize values -
Launch server:
air -c .\grpc-server.air.toml
- Launch client:
air -c .\grpc-client.air.toml
- Define the protocol buffer (.proto file) with the structures and methods (this definition is like an interface for remote procedures)
- Compile the protocol buffer with
protoc
Execute the command from the location folder of the .proto file:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
helloworld.proto
- Docker desktop
- Golang runtime
- Protocol Buffer compiler -protoc- (install with
brew
-Mac- orchocolatey
-Win-) - protoc-gen
Install protoc-gen:
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2