It is a simple hello world program which uses gRPC-Gateway. This project was created when I participated in Google Season of Docs with gRPC-Gateway. The reason for making this project is to make people familiarize with gRPC-Gateway and how they can use gRPC-Gateway in their project.
I have added all tutorials related to it in gRPC-Gateway documentation website.
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_grpc.pb.go
Before running this project install all the required Go packages by running the command make install
. Also, you 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"}