4

GitHub - iamrajiv/helloworld-grpc-gateway: It is a simple hello world program th...

 1 year ago
source link: https://github.com/iamrajiv/helloworld-grpc-gateway
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
helloworld-grpc-gateway.svg

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.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

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK