Skip to content

tejashwi-07/DummyGrpcServer

Repository files navigation


Hello World gRPC-Gateway

Simple hello world program which uses gRPC-Gateway

About

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 introduce and familiarize individuals with gRPC-Gateway.

All the tutorials related to Hello World gRPC-Gateway have been added to the gRPC-Gateway documentation website.

The folder structure of the project is as follows:

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

Installation

Before running this project, we need to install the required Go packages. To do this, run the following command:

make install

Generating stubs

We can generate the stubs for the project using the following command:

make generate

Cleaning stubs

To delete the stubs, use the following command:

make clean

Running the server

To run the server, use the following command:

go run main.go

Sending HTTP Requests

To send an HTTP POST request to the server, use cURL with the following command:

curl -X POST -k http://localhost:8090/v1/example/echo -d '{"name": "hello"}'

The server will respond with the following message:

{"message":"hello world"}

Note that the server runs on port 8090 and the endpoint is /v1/example/echo. The name field in the request is used in the response message.

Swagger UI

We can view and test the API using the Swagger UI at the following link: https://app.swaggerhub.com/apis/iamrajiv/Hello_World_gRPC-Gateway/2.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published