EddieSCJ / go-grpc-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go with gRPC

Installing

You'll need to install some stuff before start.

First Steps

Once you have everything installed, create a repo for your go code and after this clone it.

Inside your git project type

go mod init <link-to-your-repo>

Ex:

go mod init github.com/EddieSCJ/go-grpc-example-example

Tips

Once you created your .proto file you can generate the code with protoc. Just type in your terminal:

protoc --go_out=. --go-grpc_out=. proto/category/course_category.proto

You'll need to install evans to test you grpc api.

If you are in mac do the following, if not, click in the link and follow the instructions

brew tap ktr0731/evans
brew install evans

We are running it in port 50051 because of evans (the client we are using to test our server). If you want to change it, you'll need to change it in the main.go file.


When using streams and evans, to exit stream (declare EOF) you have to type ctrl + d in your terminal.

About


Languages

Language:Go 100.0%