This project try to evaluate the new library HTMX. For simplicity this projects implements a todo list. The data is not stored in a database. It is only stored inside the application state.
-
❏ fix the Mutex and lifetime error in the
get_state
method. I guess the lifetime config does not solve the problem -
❏ use
get_state
method for all methods that uses the app state-
This seems not so easy as expected due to some problems with the borrow checker
-
-
✓ Only the toggled item is replaced
-
✓ add a counter for done and not done tasks and update it with the click an the checkbox
-
❏ refactor
main.rs
file and move some code to other files -
❏ clear input after clicking on the add button
-
the snippet
"hx-on::after-request="this.reset()"
fixes the problem, but it is not compatible with maud.
-
To start developing you need to install Rust. You can do it via Rustup. This is a so called toolchain installer for Rust. It installs Rust and all necessary tools for the development (like cargo or clippy) and necessary toolchains for your operation system.
After that you can start developing this application. With the command cargo run
you start the server at port 8080. When you open a browser and goto the URL http://localhost:8080 you can see the frontend.
If you want to develop it is quite handy to use the cargo-watch cli tool. This tool starts a development server and recompiles the server if you save a changed file. After you installed the tool you can start the development server with the command cargo watch -x run
. This compiles the code and start the server as described above.