example for grpc-hello-with-grpc-gateway use gb on win 10
python -m grpc.tools.protoc -I....\protos -I. -I%GOPATH%\src -I%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. ../../protos/helloworld.proto
It will generate a stub file path/to/your_service.pb.go
python -m grpc.tools.protoc -I....\protos -I. -I%GOPATH%\src -I%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --grpc-gateway_out=logtostderr=true:. ../../protos/helloworld.proto
It will generate a reverse proxy path/to/your_service.pb.gw.go
src/helloworld_restful_swagger/main.go
先设置代理:(前提是安装配置好 ss)
set http_proxy=http://127.0.0.1:1080/pac?t=20170405092729716
set https_proxy=http://127.0.0.1:1080/pac?t=20170405092729716
gb vendor fetch github.com/grpc-ecosystem/grpc-gateway/runtime
gb vendor fetch google.golang.org/genproto/googleapis/api/annotations
gb build helloworld_restful_swagger
curl -sSk http://localhost:8080/v1/example/echo -d '{"name": " solaris"}'
{"message":"Hello, solaris!"}