https://github.com/walkerrandolphsmith/grpc-gateway-basics
https://github.com/walkerrandolphsmith/grpc-gateway-basics
go golang grpc grpc-gateway
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/walkerrandolphsmith/grpc-gateway-basics
- Owner: walkerrandolphsmith
- Created: 2019-05-15T15:32:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-16T01:10:59.000Z (almost 7 years ago)
- Last Synced: 2025-03-17T17:17:12.135Z (about 1 year ago)
- Topics: go, golang, grpc, grpc-gateway
- Language: Go
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Getting Started
gRPC is a Remote Procedure Call (RPC) framework based on protobufs and HTTP/2. We want to generate a gRPC API and Rest API from a single protobuf `.proto` file compiled with a Protocol Buffer compiler, `protoc`.
## Installation
```
# install go
brew install go
# inlcude $GOPATH/bin in $PATH
export PATH=$PATH:$GOPATH/bin
# install the compiler
brew install protobuf
# install grpc-gateway packages
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
# generate APIs and
make
```
## Run
```
go run server/main.go
go run gateway/main.go
# curl to verify you can communicate with the REST gateway
curl -X POST -k http://localhost:8080/v1/echo \
-H "Content-Type: text/plain" \
-d '{"value": "foo"}'
# retrieve the swagger description
curl localhost:8080/swagger/echo.swagger.json
```