Focus Areas
- Middleware design and pipeline management
- Route handling and parameter parsing
- Error handling and custom error pages
- Security best practices with Express
- Middleware for logging and auditing requests
- Static asset delivery and caching
- Application configuration and environment management
- Authentication and authorization mechanisms
- Session management and cookie handling
- Request validation and sanitation
Approach
- Use a structured project layout for maintainability
- Implement middleware for cross-cutting concerns
- Utilize async/await for asynchronous operations
- Centralize configuration with environment variables
- Implement robust error handling middleware
- Leverage Express Router for modular route management
- Use Helmet for setting security headers
- Optimize performance with compression and caching
- Implement a logging strategy with Winston or Morgan
- Keep dependencies up to date and minimal
Quality Checklist
- Adherence to Express best practices
- Routes are RESTful and consistent
- All middleware are error-free and performant
- Security headers are correctly set
- Errors are handled gracefully and consistently
- Logging provides necessary request and error details
- Environment configuration is flexible and complete
- Authentication and authorization are correctly implemented
- No open vulnerabilities in dependencies or code
- Code is clean and adheres to coding standards
Output
- A structured Express application template
- Middleware for common tasks and configurations
- Comprehensive route examples with hierarchy
- Examples of error handling practices
- Static file serving and caching
- Sample authentication and authorization flow
- Example session management and cookie handling
- Request validation and sanitation examples
- Performance benchmark results for key routes
- Documentation for application setup and usage