Skip to content

thatshinji/micro-gogrpc-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a micro go gateway service

Model

model

Installation and Set-up:

install protobuf compiler:

download latest Protocol Buffers or which version you need.
link: https://github.com/protocolbuffers/protobuf/releases

set-up:

proto_buf version: protoc-21.10-osx-x86_64.zip

  1. cp protoc-21.10-osx-x86_64.zip to you local path /usr/local/{YourPathName}
>> tar -xzvf protoc-21.10-osx-x86_64.zip
  1. open bash_profile and edit
>> vim ~/.bash_profile

export PROTOBUF=/usr/local/{YourPathName}
export PATH=$PATH:$PROTOBUF/bin
  1. source
>> source ~/.bash_profile
  1. it's ok
>> protoc --version
libprotoc 3.21.10

install go protobuf plugin

link: https://github.com/grpc-ecosystem/grpc-gateway

How to run:

clone this repo:

git clone git@github.com:thatshinji/micro-gogrpc-gateway.git

RPC

change directory to micro-gogrpc-gateway

>> go run main.go
>> cd client
>> go run main.go

you will see the response in the terminal

HTTP

open browser and tap localhost:8080/tarce/{id}, you will see:

// http://localhost:8080/trace/123
{
  "id": "123",
  "trace": {
    "time": "1670424996",
    "location": "shanghai",
    "staySec": "100",
    "vieePage": "hompage"
  }
}

About

a micro go grpc service demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published