/helloworld-grpc-gateway

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.

Primary LanguageGoMIT LicenseMIT


Hello World gRPC-Gateway

Simple hello world program which uses gRPC-Gateway

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_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"}

License

MIT