Skip to content

rokane/grpc-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Demo Application

This is an example application used to demonstrate an approach to structuring gRPC servers such that they can handle multiple API versions.

Code is spoken about in more detail in the following blog post:

Building APIs with gRPC and Go

The gRPC server itself contains two implementations of the Greeter service. Both services contain the same two endpoints (as explained below), but with different message types in an attempt to illustrate a breaking change leading to a new version (v2).

Build and Run

Build executable and run in terminal 1.

> go build ./cmd/greeter/...
> ./greeter

Call the api in terminal 2.

# API v1
> grpcurl -plaintext -v -d '{"name": "ryan"}' localhost:8080 greeter.v1.Greeter/SayHello
> grpcurl -plaintext -v -d '{"name": "ryan"}' localhost:8080 greeter.v1.Greeter/SayGoodbye

# API v2
> grpcurl -plaintext -v -d '{"first_name": "ryan", "last_name": "okane"}' localhost:8080 greeter.v2.Greeter/SayHello
> grpcurl -plaintext -v -d '{"first_name": "ryan", "last_name": "okane"}' localhost:8080 greeter.v2.Greeter/SayGoodbye

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages