An open API service indexing awesome lists of open source software.

https://github.com/russellluo/protoc-go-plugins

Some useful Go's protoc plugins.
https://github.com/russellluo/protoc-go-plugins

go grpc http protoc

Last synced: 29 days ago
JSON representation

Some useful Go's protoc plugins.

Awesome Lists containing this project

README

        

# protoc-go-plugins

Some useful Go's protoc plugins.

## Prerequisites

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

See [gRPC Go Quickstart][1] for installation instructions.

## Plugins

### protoc-gen-gohttp

Expose your gRPC services as HTTP services.

#### Installation

Install protoc-gen-gohttp:

```bash
$ 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:

```bash
$ protoc --gohttp_out=pb_pkg_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](examples) to find out how to expose a simple gRPC service as an HTTP service on the same port.

## License

[MIT][2]

[1]: http://www.grpc.io/docs/quickstart/go.html#prerequisites
[2]: http://opensource.org/licenses/MIT