In the Understanding GRPC clients recipe from Chapter 7, Web Clients and APIs, we wrote a basic GRPC server and client. This recipe will expand on that idea by putting common RPC functions in a package and wrapping them in both a GRPC server and a standard web handler. This can be useful when your API wants to support both types of client, but you don't want to replicate code for common functionality.
Getting ready
Configure your environment according to the following steps:
- Refer to the steps given in the Technical requirements section at the beginning of this chapter.
- Install GRPC (https://grpc.io/docs/quickstart/go/) and run the following commands:
- go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
- go get -u google.golang.org/grpc
How to do it...
The following steps cover the writing and running of your application:
- From your Terminal or console application...