Giter Club home page Giter Club logo

golang_grpc's Introduction

gRPC based Implementation in Golang

This project helps you in understanding gRPC based concepts and it's implementation
NOTE : Keep all proto files in $GOPATH/protofiles under their project names directory (best practices)

Installation

mkdir $GOPATH/protofiles 

mkdir $GOPATH/protoFiles/grpc_tutorial

Copy this file :

https://github.com/amulyakashyap09/golang_grpc/blob/master/users.proto to $GOPATH/protoFiles/grpc_tutorial

RUN this command :

protoc -I /protofiles /protofiles/grpc_tutorial/users.proto --gout=plugins=./grpc_tutorial

  • Above command will generate the grpc_tutorial named directory under $GOPATH/src
  • With nested folder name pb which contains a file named users.pb.go
  • This file is generated by proto compiler
cd $GOPATH/src/grpc_tutorial
mkdir client server
touch client/main.go server/main.go server/data.go

Now you have your project strcuture ready.

Copy files to their respective directories :

Now we are done with project and its content.

Usage

BUILD & EXECUTE SERVER :

Build the server : go install grpc_tutorial/server

Execute the server binary : $GOPATH/bin/server

BUILD & EXECUTE CLIENT :

Build the client : go install grpc_tutorial/client

Execute the client binary : $GOPATH/bin/client -o <int_value> with options

Now after executing client you have to pass inputs over cli

  • 1 sending metadata to server | $GOPATH/bin/client -o 1
  • 2 Fetching User by ID | $GOPATH/bin/client -o 2
  • 3 Fetch all users | $GOPATH/bin/client -o 3
  • 4 Save user to file | $GOPATH/bin/client -o 4
  • 5 Save all users to file | $GOPATH/bin/client -o 5

And you'll see output everytime on the terminal when any command executes.

Version

  • 0.0.1 | basic implementation of gRPC in golang

Author

golang_grpc's People

Contributors

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