json-server
json-server copied to clipboard
Add Morgan Middleware for HTTP Request Logging
Summary
Added Morgan middleware to log details for each incoming request.
Details
- Integrated the
morganpackage to enable HTTP request logging. - Configured Morgan to use the
'tiny'format for concise logs. - Logs will include essential details such as:
- HTTP method
- URL
- Status code
- Response time
Purpose
This enhancement improves visibility into incoming HTTP requests, aiding in debugging and monitoring the application.
Testing
- Verified locally by observing logs for various API endpoints in the console.
- Checked with different request methods (GET, POST, etc.) to ensure logs are correctly generated.