GithubHelp home page GithubHelp logo

rpc-demo's Introduction

gRPC with Golang demo

Quickstart

In order to install protobuf on your own machine, you can use the following commands

```sh
$ go install google.golang.org/grpc/cmd/[email protected]
$ go install google.golang.org/grpc/cmd/[email protected]
```

Download a client for your gRPC backend:

```sh
   $ go install github.com/fullstorydev/grpcui/cmd/grpcui@latest
```

You would also have to setup a protobuf compiler on your local machine and you would install that with the following command according to the platform you work on:

Linux, using apt or apt-get, for example:

```sh
$ apt install -y protobuf-compiler
$ protoc --version  # Ensure compiler version is 3+
```

MacOS, using Homebrew:

```sh
$ brew install protobuf
$ protoc --version  # Ensure compiler version is 3+
```

Run the service

From the server/ directory:

Run the server:

```sh
$ go run server/main.go
```
From another terminal, run the client:

```sh
$ grpcui --plaintext localhost:50051
```

The server port and address running locally have already been set on the `server/main.go` file.

Congratulations! You’ve just run a client-server application with gRPC.

Whenever you change the schema on the proto file, you must regenerate the packaging files. You achieve in this project with this command.

```sh
    $ protoc --proto_path=proto proto/*.proto --go_out=. --go-grpc_out=.
```

Check out the docs for setting up the Python gRPC server: Python gRPC

rpc-demo's People

Contributors

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