helloworld-grpc-gateway
helloworld-grpc-gateway copied to clipboard
This project is a basic hello world program utilizing gRPC-Gateway. It was developed as part of my participation in Google Season of Docs 2020 with gRPC-Gateway. The goal of this project is to introdu...
About
It is a simple hello world program that uses gRPC-Gateway. This project was created when I participated in Google Season of Docs 2020 with gRPC-Gateway. The reason for making this project is to make people familiarize themselves with gRPC-Gateway.
I have added all the tutorials related to Hello World gRPC-Gateway to the gRPC-Gateway documentation website.
To get more references about gRPC-Gateway check out Basic Arithmetic gRPC Server.
It is a Basic Arithmetic gRPC server that uses gRPC-Gateway and reads protobuf service definitions and generates a reverse-proxy server. It performs four basic operations Addition, Division, Multiplication, and Subtraction between two given integers.
Folder structure:
.
├── LICENSE
├── Makefile
├── README.md
├── assets
│ └── helloworld-grpc-gateway.svg
├── buf.gen.yaml
├── buf.yaml
├── go.mod
├── go.sum
├── main.go
└── proto
├── google
│ └── api
│ ├── annotations.proto
│ └── http.proto
└── helloworld
├── hello_world.pb.go
├── hello_world.pb.gw.go
├── hello_world.proto
├── hello_world.swagger.json
└── hello_world_grpc.pb.go
Usage
Before running this project install all the required Go packages by running the command make install
. Also, we can generate the stubs using the command make generate
and delete the stubs using the command make clean
.
Start the server using the command:
go run main.go
Then use cURL to send HTTP requests:
curl -X POST -k http://localhost:8090/v1/example/echo -d '{"name": "hello"}'
{"message":"hello world"}
Swagger UI
Link: https://app.swaggerhub.com/apis/iamrajiv/Hello_World_gRPC-Gateway/2