Rework README.md & CHANGELOG.md

This commit is contained in:
Tristan D. 2025-04-15 00:59:30 +02:00
parent fecb084cd5
commit 9dc4cc6c37
Signed by: tristan
SSH key fingerprint: SHA256:9oFM1J63hYWJjCnLG6C0fxBS15rwNcWwdQNMOHYKJ/4
2 changed files with 57 additions and 38 deletions

View file

@ -1,47 +1,61 @@
# Unreleased # Changelog
- nothing yet All notable changes to this project will be documented in this file.
# 0.3.0 ## [Unreleased]
After a lot of experimenting it seems I'm starting to settle on an API, so this should likely be the last breaking change in a while. - No changes yet
## Breaking ## [0.3.0] - 2025-04-15
### Rework into attribute macro. After some experimentation, the API has begun to stabilize. This should likely be the last breaking change for some time.
Instead of this ### Breaking Changes
```rust - **Reworked implementation into an attribute macro**
// ... - Previous implementation required function calls:
folder_router!("./examples/simple/api", AppState); ```rust
// ... folder_router!("./examples/simple/api", AppState);
let folder_router: Router<AppState> = folder_router(); // ...
``` let folder_router: Router<AppState> = folder_router();
```
- New implementation uses an attribute macro:
```rust
#[folder_router("./examples/simple/api", AppState)]
struct MyFolderRouter;
// ...
let folder_router: Router<AppState> = MyFolderRouter::into_router();
```
- This approach provides a cleaner API and allows for multiple separate folder-based Routers
It now works like this: ## [0.2.3] - 2025-04-14
```rust
// ...
#[folder_router("./examples/simple/api", AppState)]
struct MyFolderRouter
// ...
let folder_router: Router<AppState> = MyFolderRouter::into_router();
```
This is a bit cleaner & it allows you to have multiple separate folder-based Routers. ### Changed
- **Improved method detection** - Now properly parses files instead of using string matching
- Previous version checked if file contained ```pub async #method_name```
- New version properly parses the file using `syn` for more accurate detection
# 0.2.3 ## [0.2.2] - 2025-04-14
- Refactored the detection of which methods exist,
we actually parse the file now instead of just checking that it contains `pub async #method_name`
# 0.2.2 ### Changed
- Re-licensed to MIT - **License changed to MIT**
# 0.2.1 ## [0.2.1] - 2025-04-14
- Documentation & test improvements
# 0.2.0 ### Improved
- Generate module imports instead of `include!`ing, so rust-analyzer works. - Enhanced documentation
- Added more comprehensive tests
# 0.1.0 ## [0.2.0] - 2024-04-14
- MVP adapted from https://github.com/richardanaya/axum-folder-router-htmx
### Changed
- **Improved code integration**
- Generate module imports instead of using ```include!```
- Makes the code compatible with rust-analyzer
- Provides better IDE support
## [0.1.0] - 2024-04-14
### Added
- Initial release
- Minimum viable product adapted from https://github.com/richardanaya/axum-folder-router-htmx

View file

@ -4,16 +4,21 @@
![Maintenance](https://img.shields.io/badge/maintenance-actively--developed-brightgreen.svg) ![Maintenance](https://img.shields.io/badge/maintenance-actively--developed-brightgreen.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# axum-folder-router # axum-folder-router
```folder_router``` is a procedural macro for the Axum web framework that automatically generates router boilerplate based on your file structure. ```#[folder_router(...)]``` is a procedural attribute macro for the Axum web framework that automatically generates router boilerplate based on your direcory & file structure.
It simplifies route organization by using filesystem conventions to define your API routes. Inspired by popular frameworks like next.js.
## Features
- **File System-Based Routing**: Define your API routes using intuitive folder structures
- **Reduced Boilerplate**: Automatically generates route mapping code
- **IDE Support**: Generates proper module imports for better rust-analyzer integration
- **Multiple Routers**: Create separate folder-based routers in the same application
## Usage ## Usage
See [the examples](./examples) or [docs.rs](https://docs.rs/axum-folder-router). For detailed instructions see [the examples](./examples) or [docs.rs](https://docs.rs/axum-folder-router).
## License ## License