-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Add centralized logging and error handling middleware for better debugging and maintainability.
User Story
Given API requests
When they are processed
Then they should be logged and errors handled consistently
Tasks
- Create request logging middleware:
- Log method, URL, timestamp
- Create error handling middleware:
- Catch all errors
- Standardize error response
- Handle common errors:
- Validation errors
- Not found
- Server errors
- Integrate middleware into Express app
- (Optional) Add logging library (e.g.,
morganorwinston) - Add Swagger error response examples
Acceptance Criteria
- All requests are logged
- Errors return consistent JSON format
- Server does not crash on errors
- Proper HTTP status codes used
Testing Steps
- Hit any endpoint → check logs
- Trigger validation error → check response format
- Trigger server error → verify
500response
Definition of Done
- Logging middleware added
- Error middleware added
- App handles errors gracefully
- Code linted and formatted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Backlog