Feature/api error handling refactor

Merged Zhaofang He requested to merge feature/api-error-handling-refactor into develop

refactor: Implement unified API error handling middleware

  • Add withRequestTracking middleware for public APIs
  • Add withAuthAndTracking middleware for authenticated APIs
  • Refactor all 7 API routes to use centralized error handling
  • Remove 196+ lines of duplicate error handling code
  • Implement consistent request tracking with unique request IDs
  • Add structured logging across all API endpoints
  • Fix ML API weather data handling for forecast requests
  • Update all comments to English for consistency

APIs refactored:

  • /api/contact - Basic request tracking
  • /api/parks - Basic request tracking
  • /api/EV-charging - Basic request tracking
  • /api/bikes - Basic request tracking
  • /api/validation - Auth + request tracking
  • /api/manhattan - Auth + request tracking
  • /api/token - Basic request tracking

Closes: API error handling duplication issue

Merge request reports