From 9dc4cc6c379b069de71dcfe1726bff28ecfc9821 Mon Sep 17 00:00:00 2001 From: Tristan Druyen Date: Tue, 15 Apr 2025 00:59:30 +0200 Subject: [PATCH] Rework README.md & CHANGELOG.md --- CHANGELOG.md | 80 ++++++++++++++++++++++++++++++---------------------- README.md | 15 ++++++---- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae6a74..96002d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 -// ... -folder_router!("./examples/simple/api", AppState); -// ... -let folder_router: Router = folder_router(); -``` +- **Reworked implementation into an attribute macro** + - Previous implementation required function calls: + ```rust + folder_router!("./examples/simple/api", AppState); + // ... + let folder_router: Router = folder_router(); + ``` + - New implementation uses an attribute macro: + ```rust + #[folder_router("./examples/simple/api", AppState)] + struct MyFolderRouter; + // ... + let folder_router: Router = MyFolderRouter::into_router(); + ``` + - This approach provides a cleaner API and allows for multiple separate folder-based Routers -It now works like this: -```rust -// ... -#[folder_router("./examples/simple/api", AppState)] -struct MyFolderRouter -// ... -let folder_router: Router = MyFolderRouter::into_router(); -``` +## [0.2.3] - 2025-04-14 -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 -- 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] - 2025-04-14 -# 0.2.2 -- Re-licensed to MIT +### Changed +- **License changed to MIT** -# 0.2.1 -- Documentation & test improvements +## [0.2.1] - 2025-04-14 -# 0.2.0 -- Generate module imports instead of `include!`ing, so rust-analyzer works. +### Improved +- Enhanced documentation +- Added more comprehensive tests -# 0.1.0 -- MVP adapted from https://github.com/richardanaya/axum-folder-router-htmx +## [0.2.0] - 2024-04-14 + +### 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 diff --git a/README.md b/README.md index 5776a8e..7d4e36f 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,21 @@ ![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) - - # axum-folder-router -```folder_router``` is a procedural macro for the Axum web framework that automatically generates router boilerplate based on your file structure. -It simplifies route organization by using filesystem conventions to define your API routes. +```#[folder_router(...)]``` is a procedural attribute macro for the Axum web framework that automatically generates router boilerplate based on your direcory & file structure. +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 -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