DummyGrpcServer

command module
v0.0.0-...-760c72e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 15 Imported by: 0

README


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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
proto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL