grpc-gateway

Build Container

make image

Run Container

docker run -p 5566:5566 -p 8080:8080 grpc-docker:latest

Run Binaries

Run the client a few times

./bin/client

Now visit http://localhost:8080/swagger-ui to make REST calls interactively.
Alternatively, use curl:

curl -X POST "http://localhost:8080/api/users" -H "accept: application/json" ; echo
curl -X GET "http://localhost:8080/api/v1/users" -H "accept: application/json" ; echo
curl -X POST "http://localhost:8080/api/v1/updateBalance/{user.id}/{balance}" -H "accept: application/json" ; echo

Regenerating code after proto file changes

The gRPC and REST bindings plus swagger file are generated automatically from the proto file. The generated files are committed to the repo so you don't need to run these commands to try the code.

However, if you make changes to the proto file you'll need to regenerate like this:

make generate