Skip to content

amakmurr/helloworld-go-grpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helloworld in Go gRPC

If you not familiar with gRPC you may want to read Introduction to gRPC first.

Prerequisites

Install the protocol compiler plugin for Go (protoc-gen-go) using the following command:

export GO111MODULE=on # Enable module mode
go get github.com/golang/protobuf/protoc-gen-go

Update your PATH so that the protoc compiler can find the plugin:

export PATH="$PATH:$(go env GOPATH)/bin"

How to compile generated proto buffer in Go

protoc --go_out=plugins=grpc:../. protobuf/helloworld.proto

generate grpc-gateway

protoc --grpc-gateway_out ../. protobuf/helloworld.proto

generate swagger config

protoc --swagger_out . protobuf/helloworld.proto

or generate everything at once

protoc --go_out=plugins=grpc:../. --grpc-gateway_out ../. --swagger_out . protobuf/helloworld.proto

How to run

Run the gRPC server

go run server/main.go

Run the REST server

go run rest/main.go

Run the client

go run client/main.go [name]

About

Helloworld in Go gRPC

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages