~busykoala/rs_scratch

Scratch app for a rust web server.
b22067ed — Matthias Osswald 1 year, 2 months ago
Add future ideas.
4fd438ac — Matthias Osswald 1 year, 2 months ago
Add get route for single task.
0aab9595 — Matthias Osswald 1 year, 2 months ago
Run migrations on startup and refactore pooling function.

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~busykoala/rs_scratch
read/write
git@git.sr.ht:~busykoala/rs_scratch

You can also use your local clone with git send-email.

#Scratch Backend

#Contains

  • Router & Endpoints
  • DB, ORM & Migration -> Diesel/Async?
  • i18n Support
  • Login Handler
  • Logging

#Run

# run app in normal mode
cargo run
# run app with auto reload (on change)
# you will need to install cargo-watch
systemfd --no-pid -s http::3000 -- cargo watch -x run

#Test

cargo test

#Build

cargo build

#CI

Checkout: https://doc.rust-lang.org/cargo/guide/continuous-integration.html

#Database

Install the helper tool diesel_cli globally:

cargo install diesel_cli --no-default-features --features postgres

Possibly you will need to install further system pkgs like postgresql-libs to be able to compile.

#Setup DB

# adapt the connection string in your .env
diesel setup

#Migrations

Adding a migration:

diesel migration generate <migration name>
# then add your up.sql and down.sql files

Running / redo migrations:

diesel migration run
diesel migration redo

#Notes

What could be interesting to look at and test within this project:

  • Paperclip to generate OpenAPI specs.
  • Implementing testing for all the routes and eventually DB.
  • Juniper for GraphQL endpoints.