Skip to content

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.

Notifications You must be signed in to change notification settings

roboncode/go-grpc-example

Repository files navigation

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)

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published