A repository for setting up gRPC, gRPC-Gateway, Buf and benchmarking.
Prerequisites
Clone the repository.bash
git clone [email protected]:firacloudtech/grpc-gateway-with-swagger-with-buf.git
Register a Buf account and follow the instruction to update your BUF_USER environment variable. Replace $BUF_USER with your own buf profile name. BSR
Push the build to BSR and update the import paths with with your BUF prod
package main
import (
"context"
"fmt"
"log"
orderv1 `github.com/$BUF_USER/grpc-grpc-gateway-swagger-buf/gen/go/order/v1`
productv1 "github.com/$BUF_USER/grpc-grpc-gateway-swagger-buf/gen/go/product/v1")
Run the following command.
make buf-generate
make buf-push
To run the grpc server and grpc-gateway, Run
make run-server
To run the grpc client, Run
make run-client
To view the swagger documentation, go to http://127.0.0.1:3001/docs/