Service Generator
Usage
azu generate service SERVICE_NAME [OPTIONS]Description
Options
Examples
Generate a basic service
Generate a service with specific methods
Generate a service with description
Generated Files
Service Class (src/services/SERVICE_NAME.cr)
src/services/SERVICE_NAME.cr)Test File (spec/services/SERVICE_NAME_spec.cr)
spec/services/SERVICE_NAME_spec.cr)Service Patterns
Basic Service Pattern
Service with Error Handling
Service with Dependencies
Best Practices
1. Single Responsibility
2. Dependency Injection
3. Error Handling
4. Method Naming
Integration with Controllers
Testing Services
Unit Testing
Mocking Dependencies
Common Service Types
1. CRUD Services
2. External API Services
3. Processing Services
Related Commands
Templates
Last updated