Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 1.84 KB

File metadata and controls

82 lines (54 loc) · 1.84 KB

Sample gRPC Service in Go

The following gRPC sample project is built in Go and connects to a MongoDB. The project also exposes the services as HTTP. In the examples directory you will see both gRPC and HTTP client samples.

Authored by: Rob Taylor roboncode@gmail.com

Getting Started

Running service from CLI

go mod download
go mod vendor
go run cmd/example/main.go

Running as docker container (using docker-compose)

make docker
make compose

Building an executable

make
./bin/example

Running example gRPC and HTTP clients

Be sure the service is running using one of the methods above

go run examples/main.go

Running HealthCheck

First install health checker:

~/go/bin/grpc-health-probe -addr=localhost:8080

Run tests

go test ./...

Learn more from these resources

Go layout standards

gRPC Basics

gRPC compiler used

Exposing gRPC through HTTP

Heath Check (commonly used Kubernetes pods)