- Middleware:
• Add togglable middleware support at global, router, and route level
• Register CORS and Logging middleware based on config flags
• Inject structured logger into request context via LoggingMiddleware
- Configuration:
• Expand `ramchi.config.json` with:
◦ enableCORS, allowedOrigins
◦ enableRequestLogging
◦ enableTLS, tlsCertFile, tlsKeyFile
◦ read/write/idle timeouts and maxHeaderBytes
• Middleware toggling tied directly to these fields
- Tests:
• Added validation for CORS headers
• Added logger context assertion
• Error routes now return JSON-formatted error messages
• Assert proper registration paths and method handling
- Docs:
• README now documents all configuration fields
• Added togglable middleware section
BREAKING CHANGE:
- Middleware registration is now config-driven. Any middleware not explicitly enabled via config will not be applied.
- LoggingMiddleware depends on `enableRequestLogging` in config.
- CORSMiddleware requires both `enableCORS=true` and non-empty `allowedOrigins`.
- `ramchi/config.New()` must be called before any server instantiation.
- Routes and middleware marked as `Experimental=true` require `"experimental": true` in config.
- Errors are no longer returned using `Handle()` (removed); replace with explicit JSON writing (e.g., `json.NewEncoder(w).Encode(...)`).