Files
nginx-serve/.cursorrules
Edward Langley 0c0a44a533 Integrate domain.rs functional core into handler (DI architecture)
Now Actually Using:
- ValidatedConfig: Parse config into validated types at request time
- ParameterBinding: Type-safe parameter representation
- RequestProcessor: Pure business logic with injected dependencies
- resolve_template_path(): Pure function for path resolution
- resolve_parameters(): Pure parameter resolution

New Adapters (adapters.rs):
- NginxVariableResolver: Implements VariableResolver trait
- SqliteQueryExecutor: Implements QueryExecutor trait
- HandlebarsAdapter: Implements TemplateLoader + TemplateRenderer

Handler Flow (Functional Core, Imperative Shell):
1. Parse strings into validated types (types.rs)
2. Create validated config (domain.rs)
3. Resolve template path (pure function)
4. Create adapters (adapters.rs - imperative shell)
5. Call RequestProcessor.process() (pure core)
6. Return HTML (imperative shell)

Benefits:
✓ Type validation happens at request time
✓ Invalid queries caught early (SELECT-only enforced)
✓ Core business logic is pure and testable
✓ Real DI: can swap implementations via traits
✓ Clear separation of concerns

Test Coverage: 47 tests (added 2 adapter tests)
Production: Verified working with all features

The architecture documented in ARCHITECTURE.md is now actually implemented!
2025-11-15 16:48:54 -08:00

2 lines
172 B
Plaintext

- Always use `direnv exec "$PWD"` when invoking cargo and other tools that need access to the nix/direnv environment
- Avoid using `head` and `tail` to avoid missing output