Coder Social home page Coder Social logo

grpc's Introduction

gRPC


How to use

Manual Code Generation

protoc -Igreet/proto --go_out=. --go_opt=module=github.com/MartinLupa/gRPC --go-grpc_out=. --go-grpc_opt=module=github.com/MartinLupa/gRPC greet/proto/dummy.proto

Explanation of command flags:

  • -Igreet/proto: -I/ indicates where the input file is.

  • --go_out=. and --go-grpc_out=.: indicate that we want to generate the code in the current directory. But will be influenced by --go_opt and --go-grpc_opt.

  • --go_opt=module=github.com/MartinLupa/gRPC and --go-grpc_opt=module=github.com/MartinLupa/gRPC: we are indicating that our module is called "github.com/MartinLupa/gRPC", so the command will remove this part of the string from the go_package(originally "github.com/MartinLupa/gRPC/greet/proto") and will leave only "./greet/proto", so the output of the command will be available in such path of ./greet/proto.

  • greet/proto/dummy.proto: indicates where the .proto file is located.

Code Generation with Makefile

  • make <project_name>: to generate the code out of the .proto file.
  • make help: to see all available options.

Running client and server

  • open one terminal and run ./bin/<project_name>/server
  • open a second terminal and run ./bin/<project_name>/client

Projects

Check the README.md file inside each project to learn how to use it.

greet(Greet) and calculator(Sum): gRPC Unary API

Simple greeting and calculator gRPC Unary API.

greet: gRPC Unary README.md

calculator: gRPC Unary README.md

greet(GreetManyTimes) and calculator(Primes): gRPC Server Streaming API

The GreetService and CalculatorService are modified by adding function calls that support streams on the server.

greet(LongGreet) and calculator(Avg): gRPC Client Streaming API

The GreetService and CalculatorService are modified by adding function calls that support streams on the client.

greet(GreetEveryone) and calculator(Max): gRPC Bi-Directional Streaming API

The GreetService and CalculatorService are modified by adding function calls that support streams on the client.

Other features

  • GreetWithDeadline: includes waiting timeouts for responses.
  • Greet server/client: SSL Security.
  • Reflection & Evans CLI: to visualize services and endpoints.

Running evans CLI (visualize and test packages, services, messages, and endpoints):

show package

show package screenshot

show message

show message screenshot

package calculator & show service

show service screenshot

call Sum (testing Sum endpoint)

call Sum endpoint screenshot

grpc's People

Contributors

martinlupa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.