/go-grpc-http-rest-microservice-tutorial

A sample repo containing gRPC and REST API implementations written in Go

Primary LanguageGoMIT LicenseMIT

gRPC and REST API using Golang

Build Status Coverage Status

Based on these tutorials:

Build

  • Run Protoc

    ./third_party/protoc-gen.sh
    
  • Build Server

    cd cmd/server
    go build
    
  • Build REST and gRPC Clients

    cd cmd/client-rest
    go build
    
    cd cmd/client-grpc
    go build
    

Running

Build Docker Image

docker build . -t go-dock  
docker run -d -p 8080:8080,9090:9090 --name=go-dock --env DB_HOST=localhost:3306,DB_USER=root,DB_PASSWORD=**********,DB_SCHEMA=mysql go-dock
docker run -it -p 8080:8080,9090:9090 --name=go-dock --env DB_HOST=localhost:3306,DB_USER=root,DB_PASSWORD=**********,DB_SCHEMA=mysql go-dock

MySQL

docker pull mysql/mysql-server:latest
docker images
docker run --name=mysql -d mysql/mysql-server:latest