setup db module
static file serving
custom error type
The goal of this project is to make a proof-of-concept for the combination of Rust, Axum, Sqlx, Askama, and HTMX for web applications.
We want a web application that supports stateful sessions, database backend, and eventually single-sign-on with KeyCloak/OIDC.
Print hello world to the root (/) path with pure Rust/Axum.
cargo add tokio --features=full
cargo add axum
Latest at this point is Axum v0.7.9, and Tokio v1.42.0.
Print hello world from an Askama template.
cargo add aksama aksama_axum
Latest version of aksama is v0.12.1, aksama_axum is v0.4.0.
We'll also add hyper
to be able to access HTTP status codes.
cargo add hyper
Latest hyper is v1.5.1
Add some custom error handling functionality, using thiserror
, as well as static file serving (images, CSS, etc.).
cargo add thiserror serde -F serde/derive
Now when you hit a page other than /, you get the 404 template.
Using version v2.0.6 of thiserror, and v1.0.216 of serde.
cargo add tower-http -F fs
Using tower-http v0.6.2.
Initialize a database if one does not exist.
Print hello world from a database query.
cargo add sqlx --features "sqlite runtime-tokio"
Version v0.8.2 used.
This will hold all our DB functionality.
Add db.rs
Use HTMX to replace a button with content from a database query.