Example gRPC server implemented in Go
Deploy the app
export DOMAIN=my.cf.app.domain
cf push -f app-manifest.yml --var domain=$DOMAIN
cf push --no-route go-grpc-test --buildpack go_buildpack
# my.cf.app.domain is used as an example for demonstration purpose
cf map-route go-grpc-test my.cf.app.domain --hostname go-grpc-test --app-protocol http2
grpcurl
needs to be installed separately.
grpcurl go-grpc-test.my.cf.app.domain:443 example.Example.Run
go build
PORT=8080 ./go-grpc
grpcurl -vv -plaintext localhost:8080 example.Example.Run
grpcurl
needs to be installed separately.
The generated code is created using the Protoc compiler, which needs to be installed separately.
The following steps can then be used to re-generate the gRPC files in example/
.
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
protoc --go_out=$PWD example.proto
protoc --go-grpc_out=$PWD example.proto