{% assign name = crate_name | remove: "_service" %}{% assign plural_name = name | append: "s" %}{% assign pascal = name | pascal_case %}
This is a project template using cargo generate. The idea is to create a new service from scratch using this as a template. This includes a sample model and embedded object model as well as a bunch of tests. It requires using the latest version of cargo generate. So to install that do:
cargo install --git https://github.com/ashleygwilliams/cargo-generateThen to create a new project:
cargo generate --git https://github.com/bdbelevate/grpc-templateAnswer the prompts and voila! you have a new project.
Note: It will rename things and remove the word "service". So if you want to create an Events service with types called Event. Then enter the name as "EventService". That will result in a crate named event-service and it will have a type of message called Event.
Install the required node packages which are used for commit hooks, etc...
npm installDownload the required crates and build the protobuf rs files.
cargo buildRun the cargo generate above. Then go and edit (and/or rename) the proto/sample.proto. Keep in mind that if you rename it you will need to change the build.rs accordingly.
If you add fields, you'll likely need to change the api/items.rs to update the update_one command.
- Install Rust
- Run
cargo runto build and run service
See garden.io
- Better TOML
- Native Debug
- Rust
- rust-analyzer
Testing the gRPC calls is best done via (BloomRPC)[https://github.com/uw-labs/bloomrpc]. More info on their site but easiest way to install it is via brew.
brew cask install bloomrpcOnce it's installed you can open the proto file to test the endpoints.