This code's has been inspired from from the grpc.io site.
POC of a gRPC project in Golang 🐿
-
helloworld/helloworld.proto
file is like a Controller class. It's where you will configure the endpoint (in gRPC, those are method names) and the DTO for request and response. -
greeter_server/main.go
file is like a Service class. It's where you will implement all the method business rules. -
greeter_client/main.go
file is an example of a programatic way to consume a gRPC method from thehelloworld.proto
andgreeter_server/main.go
files.
From the root
directory:
Run the server:
go run greeter_server/main.go
From another terminal window, run the client:
go run greeter_client/main.go
Using BloomRPC (https://github.com/uw-labs/bloomrpc)
Importing the helloworld/helloworld.proto
file.