Create a gRPC (and HTTP/JSON provided by grpc-gateway reverse proxy) Server from the generated code by the xo project.
go install github.com/xo/xo@latest
go install github.com/bufbuild/buf/cmd/buf@latest
go install github.com/walterwanderley/xo-grpc@latest
- 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]
- Execute xo-grpc to generate the gRPC Server boilerplate code:
xo-grpc models
- Run the generated server:
go run . -db [Database Connection URL] -dev -grpcui
- Enjoy!
- gRPC UI http://localhost:5000/grpcui
- Swagger UI http://localhost:5000/swagger