This project demonstrates how to build a single page application (SPA) using HTMX on top of Rust's Axum framework. It covers Axum's routing and middleware, and utilizes Handlebars for templating in Rust.
- Axum Framework: Utilizes Axum for routing and middleware.
- HTMX Integration: Leverages HTMX for building dynamic and interactive web pages without JavaScript.
- Handlebars Templating: Implements Handlebars for server-side templating.
- Rust (installed via rustup)
- Cargo (comes with Rust)
To run the application normally:
cargo run
To run the application in watch mode (automatically restarts the server when code changes are detected):
cargo watch -c -x run
- Clone the repository:
git clone https://github.com/uksarkar/htmx.git
cd htmx
- Install dependencies:
The necessary dependencies will be installed automatically when you run the application using
cargo run
. - Run the application:
cargo run
/cargo watch -c -x run
- Access the application: Open your web browser and navigate to http://localhost:3000 to see the application in action.
src/main.rs
: Entry point of the application.src/routes.rs
: Defines the application routes.src/response.rs
: Contains middleware logic and response struct.templates/
: Directory for Handlebars templates.
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.MD
├── src
│ ├── db.rs
│ ├── main.rs
│ ├── pagination.rs
│ ├── response.rs
│ └── routes.rs
└── templates
├── 404.hbs
├── about.hbs
├── index.hbs
└── user
├── list.hbs
└── view.hbs
Contributions are welcome! Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This
README.md
provides an overview of the project, instructions for running the application, and information on the project structure and contributing.