MiddlewareLogic - IEEE-Team-3/map GitHub Wiki

Auth Middleware

  • Verifies JWT token and attaches user info to req.user.
  • Redirects to login if token is missing or invalid.

Role-based Access Control

  • Checks if the current user has the required role in the team.
  • Can be extended using decorators or route-level logic.

Input Validation

  • Uses libraries like zod or express-validator.
  • Ensures correct data types and required fields.

Error Handling

  • Global error handler catches exceptions and sends clean JSON responses.
  • Differentiates between expected (e.g., validation) and unexpected errors.

Rate Limiting & Security

  • Prevents abuse on public routes like login/register.
  • Helmet + CORS + sanitizers to protect the app.
⚠️ **GitHub.com Fallback** ⚠️