https://jergoo.gitbooks.io/go-grpc-practice-guide/content/chapter3/gateway.html
etcd3 API全面升级为gRPC后,同时要提供REST API服务,维护两个版本的服务显然不太合理,所以grpc-gateway诞生了。通过protobuf的自定义option实现了一个网关,服务端同时开启gRPC和HTTP服务,HTTP服务接收客户端请求后转换为grpc请求数据,获取响应后转为json数据返回给客户端。
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
$ protoc -I . –go_out=plugins=grpc,Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor:. google/api/*.proto
$ protoc -I . –go_out=plugins=grpc,Mgoogle/api/annotations.proto=github.com/jergoo/go-grpc-example/proto/google/api:. hello_http/*.proto
$ protoc –grpc-gateway_out=logtostderr=true:. hello_http/hello_http.proto
https://www.grpc.io/blog/coreos/
https://github.com/googleapis/googleapis
https://jergoo.gitbooks.io/go-grpc-practice-guide/content/chapter3/gateway.html
https://segmentfault.com/a/1190000008106582
https://github.com/googleapis/googleapis