This repository contains a simple application that demonstrates how to use grpc and the grpc gateway with golang.
- No need to install protoc compiler because demo using docker-protoc
- An example of using gRPC Gateway
- Google APIs included
- cmd/main.go - main application
- proto/* - contains a description of application proto files
- gen/* - contains generated proto files
- third_party/* - contains third party api's
- docker-compose.yml - contains a description of gRPC/Protocol buffer compiler containers
Start the application:
$ make run
or
$ go run cmd/main.go
Create user via grpc-gateway:
$ curl -d '{"name":"John", "type":1}' -H "Content-Type: application/json" -X POST http://localhost:8080/v1/users
Get user via grpc-gateway:
$ curl -H "Content-Type: application/json" -X GET http://localhost:8080/v1/users?id=${USER_ID}
Compile protobuffs:
$ make compile-pb
or
$ docker-compose -f docker-compose.yml up