8000 GitHub - ytitov/grpc-rust-dart-demo: routeguide tutorial base to start a rust and dart server/client project
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

ytitov/grpc-rust-dart-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project contatins a rust and dart grpc servers and clients. Emphasis on rust server, and dart client. This was adapted from https://github.com/hyperium/tonic/blob/master/examples/routeguide-tutorial.md as a self contained project. Note the appendix for customizing proto building, only necessary if .proto files will be kept outside of this repo.

Requirements

  • ensure you have rustfmt installed rustup component add rustfmt
  • cargo-watch is usefull for auto-compiling: cargo install cargo-watch
  • install docker (or install postgres manually)
  • install libpq-dev apt-get install libpq-dev
  • install diesel cli (used for migrations). Note that you may need to install postgres related dev libraries on your machine. cargo install diesel_cli --no-default-features --features postgres
  • need to install protoc to compile dart files easily:
PROTOC_ZIP=protoc-3.12.3-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP

may also need to run: pub global activate protoc_plugin

proto files

The proto files are found inside the base proto folder. Anytime there is a change to any .proto files these commands must be executed to update the generated code

Generating code

Client - dart

Execute the gen_protos.sh script

Server - rust

Execute cargo run in the protobuild directory.

Server

database

Server needs a database, and assumes that there is one by default see -h if you try running the server. For local development simply enter the docker folder and use the script dc-dev.sh up which runs the development version of the setup. Add -d to it in order to run it in the background.

  • Enter docker folder, then type the command ./dc-dev.sh up -d
  • Note that you will need to run diesel migration run to generate the needed database tables for the first time

Starting

Enter the directory sy-server when running these commands:

  • cargo run --bin sy-server
  • for working on server development: cargo watch -x 'run --bin sy-server'

Client

This is a dart client. Enter the directory sy-client

  • dart bin/manageusers-cli.dart

TODO:

  • create cli tool for using the manageusers service on the dart side of things
  • create a script which executes the necessary steps to generate the server and the client code as necessary

About

routeguide tutorial base to start a rust and dart server/client project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0