Examples
Examples are available under examples/internal
directory.
proto/examplepb/echo_service.proto
,proto/examplepb/a_bit_of_everything.proto
,proto/examplepb/unannotated_echo_service.proto
: protobuf service definitions.proto/examplepb/echo_service.pb.go
,proto/examplepb/a_bit_of_everything.pb.go
,proto/examplepb/unannotated_echo_service.pb.go
: generated Go service stubs and types.proto/examplepb/echo_service.pb.gw.go
,proto/examplepb/a_bit_of_everything.pb.gw.go
,proto/examplepb/unannotated_echo_service.pb.gw.go
: generated gRPC-Gateway clients.proto/examplepb/unannotated_echo_service.yaml
: gRPC API Configuration forunannotated_echo_service.proto
.server/main.go
: service implementation.main.go
: entrypoint of the generated reverse proxy.
To use the same port for custom HTTP handlers (e.g. serving swagger.json
), gRPC-Gateway, and a gRPC server, see this code example by CoreOS (and its accompanying blog post).