|
|
6 月之前 | |
|---|---|---|
| .. | ||
| client-lite | 6 月之前 | |
| server | 6 月之前 | |
| session | 6 月之前 | |
| readme.md | 6 月之前 | |
пример с микросервисом авторизации
смысл:
Генерация кода:
protoc --go_out=plugins=grpc:. *.protoдополнительная документация
windows:
Download protoc-win32.zip from https://developers.google.com/protocol-buffers/docs/downloads
Unzip and add location of the protoc.exe to your PATH environment variable
Run protoc --version from command prompt to verify
Verify the your GOPATH environment variable is set
Run go get -u github.com/golang/protobuf/protoc-gen-go from command prompt. This should install the binary to %GOPATH%/bin
Add %GOPATH%/bin to your PATH environment variable
Open a new command prompt, navigate to your .proto file, run protoc --go_out=. *.proto
если ругается - надо читобы были доступны protoc.exe и protoc-gen-go.exe - прописать в PATH путь до них
gateway
https://github.com/grpc-ecosystem/grpc-gateway
go get -u github.com/golang/protobuf/protoc-gen-go go get -u github.com/grpc-ecosystem/grpc-gateway/...
protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --go_out=plugins=grpc:. \ session.proto
protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --grpc-gateway_out=logtostderr=true:. \ session.proto
protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --swagger_out=logtostderr=true:. \ session.proto
https://github.com/grpc-ecosystem/grpc-gateway
https://coreos.com/blog/grpc-protobufs-swagger.html https://github.com/philips/grpc-gateway-example https://mycodesmells.com/post/http-server-from-grpc-with-gateway https://github.com/alextanhongpin/go-grpc-gateway https://grpc.io/blog/coreos