Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akuity/grpc-gateway-client
grpc-gateway HTTP client generator
https://github.com/akuity/grpc-gateway-client
Last synced: about 1 month ago
JSON representation
grpc-gateway HTTP client generator
- Host: GitHub
- URL: https://github.com/akuity/grpc-gateway-client
- Owner: akuity
- License: apache-2.0
- Created: 2023-03-03T02:09:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-12T08:21:46.000Z (3 months ago)
- Last Synced: 2024-11-09T16:44:13.201Z (about 1 month ago)
- Language: Go
- Size: 87.9 KB
- Stars: 39
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - akuity/grpc-gateway-client - grpc-gateway HTTP client generator (Go)
README
# grpc-gateway-client
The `grpc-gateway-client` is a high quality REST client generator for [gRPC](https://grpc.io/) services that are fronted by [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway).
## Features
- Strongly typed client interface.
- Supports all gRPC features including streaming.
- Supports all grpc-gateway features including custom query parameters, and request body.
- Battle tested by [Akuity's](https://akuity.io/) production services.## Usage
1. Install `grpc-gateway-client`:
```bash
$ go install github.com/akuity/grpc-gateway-client/protoc-gen-grpc-gateway-client@latest
```
1. Add plugin in your buf.gen.yaml:```yaml
version: v1
managed:
enabled: trueplugins:
- name: gateway-client
path: protoc-gen-grpc-gateway-client
out: pkg/api/gen
opt:
- paths=source_relative
```
1. Generate client using `buf generate` and use it in your code:```go
client := grpc_gateway_client_example.NewGreeterGatewayClient(gateway.NewClient(baseURL))
resp, err := client.SayHello(context.Background(), &grpc_gateway_client_example.HelloRequest{Name: "World"})
if err != nil {
panic(err)
}
fmt.Println(resp.Message)
```See [example](./example/README.md) for a complete example.