Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vatsalya-singhi/6dc58cfd2e2b4cef7e62c8f3713c6b28 to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/6dc58cfd2e2b4cef7e62c8f3713c6b28 to your computer and use it in GitHub Desktop.
Feature Purpose Execution Timing Common Use Case
Middleware Modifies incoming requests (e.g., logging, CORS) Before reaching the controller Logging, modifying headers, request transformations
Guards Controls access based on authentication or roles Before executing the controller logic Role-based access, authentication checks
Interceptors Modifies or transforms responses (e.g., logging, caching) After controller processing Response formatting, performance monitoring, error handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment