A simple gRPC boilerplate project in Golang.
As my first foray into gRPC and Golang, I wanted to create a simple server and client. The server will listen for an empty TCP/gRPC message (payload={}
) from the client and respond with a Pong
message.
- gRPC server
- gRPC client
- gRPC protocol buffer spec
- gRPC code generation (
protoc
andprotoc-gen-go
) - gRPC server and client binaries
-
make
commands - github actions CI/CD pipeline
# to build the binaries
make build
# to run the server
make serve
2023/09/07 11:03:02 Starting server on port 50051
# or with a custom port
./bin/serve -port 50000
2023/09/07 11:05:18 Starting server on port 50000
# in another terminal
make ping
2023/09/07 11:03:04 Establishing gRPC connection - localhost:50051...
2023/09/07 11:03:04 Response: Pong
# or with custom port
./bin/ping -port 50000
2023/09/07 11:03:04 Establishing gRPC connection - localhost:50000...
2023/09/07 11:03:04 Response: Pong
# in the server terminal
# to stop the server, press Ctrl+C