In the Understanding GRPC clients recipe from Chapter 6, 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.
Exporting GRPC as a JSON API
Getting ready
Configure your environment according to these steps:
- Refer to the steps given in the Getting ready section of the Working with web handlers, requests, and ResponseWriters recipe.
- Install GRPC from https://github.com/grpc/grpc/blob/master/INSTALL.md.
- Run the go get github.com/golang...