Skip to content

akuity/grpc-gateway-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

55a48e8 · Sep 12, 2024

History

18 Commits
Mar 10, 2023
Sep 12, 2024
Mar 21, 2023
Sep 12, 2024
Sep 12, 2024
Mar 10, 2023
Mar 10, 2023
Mar 4, 2023
Mar 4, 2023
Jul 26, 2024
Mar 10, 2023
Mar 21, 2023
Nov 16, 2023
Mar 10, 2023
Nov 16, 2023
Nov 16, 2023

Repository files navigation

grpc-gateway-client

The grpc-gateway-client is a high quality REST client generator for gRPC services that are fronted by 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 production services.

Usage

  1. Install grpc-gateway-client:

    $ go install github.com/akuity/grpc-gateway-client/protoc-gen-grpc-gateway-client@latest
  2. Add plugin in your buf.gen.yaml:

    version: v1
    managed:
    enabled: true
    
    plugins:
      - name: gateway-client
        path: protoc-gen-grpc-gateway-client
        out: pkg/api/gen
        opt:
          - paths=source_relative
  3. Generate client using buf generate and use it in your code:

     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 for a complete example.

About

grpc-gateway HTTP client generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published