feat: improve resource routing API and add comprehensive quality standards

BREAKING CHANGES:
- Renamed HandleGET -> MemberGET for member-level routes
- Renamed HandlePOST -> MemberPOST for member-level routes
- Renamed HandlePUT -> MemberPUT for member-level routes
- Renamed HandlePATCH -> MemberPATCH for member-level routes
- Renamed HandleDELETE -> MemberDELETE for member-level routes

New Features:
- Added collection-level route methods: GET, POST, PUT, PATCH, DELETE
- Clear distinction between collection (/pattern/action) and member (/pattern/{id}/action) routes
- Comprehensive documentation (README, CONTRIBUTING, QUICKSTART, DOCS)
- Development tooling (Makefile, check.sh script)
- AI coding assistant guidelines (.cursorrules)
- GitHub Actions CI/CD pipeline
- golangci-lint configuration

Code Quality:
- Optimized struct field alignment for better memory usage
- All code passes go vet, staticcheck, and fieldalignment
- All tests pass with race detector
- Go 1.25+ requirement enforced

Documentation:
- Complete README rewrite with examples
- CONTRIBUTING.md with development guidelines
- QUICKSTART.md for new users
- CHANGELOG.md with version history
- SUMMARY.md documenting all changes
- DOCS.md as documentation index
This commit is contained in:
2025-11-15 14:05:11 +05:30
parent 75d2f88c65
commit 26bb9bf5ee
16 changed files with 2850 additions and 139 deletions

65
CHANGELOG.md Normal file
View File

@@ -0,0 +1,65 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Changed
- Renamed `HandleGET`, `HandlePOST`, `HandlePUT`, `HandlePATCH`, `HandleDELETE` to `MemberGET`, `MemberPOST`, `MemberPUT`, `MemberPATCH`, `MemberDELETE` for better clarity
- Member routes now explicitly operate on `/pattern/{id}/action` endpoints
### Added
- Collection-level custom route methods: `GET`, `POST`, `PUT`, `PATCH`, `DELETE` for `/pattern/action` endpoints
- Comprehensive README with detailed examples and usage patterns
- CONTRIBUTING.md with code quality standards and guidelines
- `.cursorrules` file for AI coding assistants
- GitHub Actions CI/CD workflow
- Makefile for common development tasks
- golangci-lint configuration
- Field alignment requirements and checks
### Documentation
- Improved README with table of contents and comprehensive examples
- Added distinction between collection and member routes in Resource documentation
- Added performance and testing guidelines
- Added examples for all major features
## [0.2.0] - Previous Release
### Added
- RESTful resource routing with `Resource()` method
- Standard resource actions: `Index`, `CreateView`, `Create`, `View`, `Update`, `UpdatePartial`, `Delete`
- Custom resource route handlers: `HandleGET`, `HandlePOST`, `HandlePUT`, `HandlePATCH`, `HandleDELETE`
- Resource-specific middleware support
### Changed
- Improved middleware stacking mechanism
- Better route organization and grouping
## [0.1.0] - Initial Release
### Added
- Basic HTTP method routing (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE, CONNECT)
- Middleware support with `Use()` method
- Route grouping with `Group()` method
- Inline middleware with `With()` method
- URL parameter extraction using Go 1.22+ path values
- Graceful shutdown with `Serve()` method
- Route listing and debugging with `PrintRoutes()` and `RouteList()`
- Zero external dependencies
- Built on top of Go's standard `http.ServeMux`
### Features
- Middleware composition and stacking
- Concurrent-safe route registration
- Signal handling (SIGINT, SIGTERM) for graceful shutdown
- Automatic OPTIONS handler
- Route conflict detection and panics
- Context-aware shutdown signaling
[Unreleased]: https://github.com/yourusername/mux/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/yourusername/mux/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/yourusername/mux/releases/tag/v0.1.0