Skip to content

Latest commit

 

History

History
51 lines (27 loc) · 932 Bytes

README.md

File metadata and controls

51 lines (27 loc) · 932 Bytes

protoc-go-plugins

Some useful Go's protoc plugins.

Prerequisites

  • gRPC
  • Protocol Buffers v3
  • the protoc plugin for Go

See gRPC Go Quickstart for installation instructions.

Plugins

protoc-gen-gohttp

Expose your gRPC services as HTTP services.

Installation

Install protoc-gen-gohttp:

$ go get -u github.com/RussellLuo/protoc-go-plugins/protoc-gen-gohttp

Usage

Generate HTTP services for all gRPC services defined in the proto file:

$ protoc <proto file> --gohttp_out=pb_pkg_path=<pb pacakge path>:<output path>

As you can see, pb_pkg_path is the path of the pb package, which is generated by protoc-gen-go.

Examples

See examples to find out how to expose a simple gRPC service as an HTTP service on the same port.

License

MIT