helloworld

command
v0.0.0-...-7fc8bb1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 7 Imported by: 0

README

Hello World

Hello world in gRPC!

Directory Structure

.
├── helloworld.proto
├── main.go
├── Makefile
├── protos
│   ├── helloworld_grpc.pb.go
│   └── helloworld.pb.go
├── README.md
└── server
    └── server.go

Testing

To test the system install grpccurl which is a command line tool which can interact with gRPC API's

Link to the repo is here!

go install github.com/fullstorydev/grpcurl/cmd/grpcurl

Run the server
  • Command: go run main.go
List Services
  • Command: grpcurl --plaintext localhost:8080 list
  • Output:
    Greeter
    grpc.reflection.v1alpha.ServerReflection
    
List Methods
  • Command: grpcurl --plaintext localhost:8080 list Currency
  • Output: Greeter.SayHello
Method detail for GetRate
  • Command: grpcurl --plaintext localhost:8080 describe Currency.GetRate
  • Output:
    Greeter.SayHello is a method:
    rpc SayHello ( .HelloRequest ) returns ( .HelloResponse );
    
RateRequest detail
  • Command: grpcurl --plaintext localhost:8080 describe .HelloRequest
  • Output:
    HelloRequest is a message:
    message HelloRequest {
        string name = 1;
    }
    
RateResponse detail
  • Command: grpcurl --plaintext localhost:8080 describe .HelloResponse
  • Output:
    HelloResponse is a message:
    message HelloResponse {
        string message = 1;
    }
    
Execute a request
  • Command: grpcurl --plaintext -d '{"name":"Ankit"}' localhost:8080 Greeter.SayHello
  • Output:
    {
        "message": "Hello Ankit"
    }
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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