Learning rust for production ready. zero2seisan should be read in Japanese, zero ni seisan (0 に 生産), means zero to production.
- cargo-watch
- cargo-tarpaulin
- clippy
- rustfmt
- cargo-audit
- clang
- lld
- sqlx-cli
- postgresql-client-14
- postgresql-client-common
- cargo-undeps
- bunyan
# Install nightly compiler.
rustup toolchain install nightly --allow-downgrade
# Linux watch like. Run cargo check, test, and run on save.
cargo watch -x check -x test -x run
# Enable trace log.
RUST_LOG=trace cargo run
# Pipe the output to bunyan for more readeble output.
RUST_LOG=trace cargo run | bunyan
# Build docker image.
docker build --tag zero2seisan --file Dockerfile .
# Run docker image.
docker run -p 8000:8000 zero2seisan
# Generate .sqlx directory for offline mode sqlx.
cargo sqlx prepare --workspace
export DATABASE_URL=postgres://postgres:password@127.0.0.1:5432/newsletter
sqlx database create
sqlx migrate add create_subscriptions_table
sqlx migrate run
curl -d "name=le%20guin&email=ursula_le_guin%40gmail.com" -X POST http://localhost:8000/subscriptions -v