https://github.com/alfenfebral/go-grpc
gRPC example using go, include with credentials, rest-api gateway and swagger docs
https://github.com/alfenfebral/go-grpc
go golang grpc grpc-gateway rest-api
Last synced: 2 months ago
JSON representation
gRPC example using go, include with credentials, rest-api gateway and swagger docs
- Host: GitHub
- URL: https://github.com/alfenfebral/go-grpc
- Owner: alfenfebral
- Created: 2019-02-22T14:04:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-23T08:33:17.000Z (over 7 years ago)
- Last Synced: 2025-12-21T08:50:37.935Z (6 months ago)
- Topics: go, golang, grpc, grpc-gateway, rest-api
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
Make sure if you have protobuf installed in your system if not, use command below.
```bash
brew install protobuf
```
Make sure if you have protoc-gen-go installed in your system if not, use command below.
```bash
go get -u github.com/golang/protobuf/protoc-gen-go
```
Make sure if you have protoc-gen-grpc-gateway installed in your system if not, use command below.
```bash
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
```
Make sure if you have protoc-gen-swagger installed in your system if not, use command below.
```bash
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
```
this will generate a ```swagger.json``` file
## Compile Proto files
before your run server or client, you should compliled .proto files using this command.
```bash
make
```
## Run Server
gRPC server will run at port ```:7777``` and REST server will run at port ```:7778```
```bash
go run server.go
```
### Run Client
```bash
go run client.go
```
## Test Rest API
```bash
curl -H "login:john" -H "password:doe" -X POST -d '{"to":"foo@foo@foo", "subject":"Foo", "message":"Foo"}' 'http://localhost:7778/1/email'
```