Home

Awesome

xo-grpc

Create a gRPC (and HTTP/JSON provided by grpc-gateway reverse proxy) Server from the generated code by the xo project.

Requirements

go install github.com/xo/xo@latest
go install github.com/bufbuild/buf/cmd/buf@latest

Installation

go install github.com/walterwanderley/xo-grpc@latest

Example

  1. Generate go code to access your database using xo. For more informations about xo command line parameters, please visit the xo Documentation
mkdir models
xo schema -o models [Database Connection URL] 
  1. Execute xo-grpc to generate the gRPC Server boilerplate code:
xo-grpc models
  1. Run the generated server:
go run . -db [Database Connection URL] -dev -grpcui
  1. Enjoy!

Similar Projects