grpc入门2

rpc-gateway使用(同时提供rpc和http接口)

介绍第三方库

https://github.com/grpc-ecosystem/grpc-gateway

在grpc之上加一层代理并转发,转变成protobuf格式来访问grpc服务

安装

go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go

安装好后在gopath的bin目录下

原文地址:https://www.cnblogs.com/sunlong88/p/11863024.html