- /cmd: contains local app main function
- /rpc: contains /service which is the implementation of the generated protobuf server interface. And /client containing a client-connection helper
- /handler: contains http.Handlers that invoke the remote grpc functions via the client-connection
- /proto contains the rpc .proto file and generated interfaces
The RPC server exposes a simple user management API
go run ./rpc/service go run ./cmd/app.gocurl --location --request POST 'localhost:8081/api/user/create' \
--header 'Content-Type: application/json' \
--data-raw '{
"Name":"Adam",
"Age":10
}'curl --location --request GET 'localhost:8081/api/users'curl --location --request GET 'localhost:8081/api/user?user_id=8f37caae-a76d-45b8-8cb4-be79c21f6ef1'protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ./proto/def.proto