This project is an example using gRPC gateway, Envoy proxy to transcode gRPC API server into REST API server. Furthermore, I use denny framework which is not transcode gRPC API server into REST API server. Denny not only exposes gRPC and http api server in 1 port but also invoke the code you wrote in grpc functions, does not trigger grpc call when you call http.
Generating client and server code and reverse-proxy for your REST API:
make gen-protobuf
- Run all project
make dc-all
- Use grpc gateway
make dc-gateway
- Use envoy
make dc-envoy
- Use denny
make dc-denny
Install extension REST client on VS Code for easy send api call with *.http files in /client folder
- List entities
curl -X GET 'http://localhost:8080/entities'
- Create entity
curl -X POST 'http://localhost:8080/entities' -d '{"name":"Phuc qua dep trai","description":"Kha la banh","url":"phucdeptrai.com.vn"}'
- Read entity
curl -X GET "http://localhost:8080/entities/5d11e96b9dadaf6eef8599be"
- Update entity
curl -X PUT 'http://localhost:8080/entities' -d '{"id":"5dff0ab0ac327677d38754dd","name":"Phuc dep trai vai","description":"Qua la banh","url":"phuchotboy.com.vn"}'
- Delete entity
curl -X DELETE "http://localhost:8080/entities/5d11e8ee9dadaf6eef8599b9"