LearningTech

Communication

API Gateway

Description

An API Gateway is a server that acts as an API front-end, receiving API requests, enforcing throttling and security policies, passing requests to the back-end service and then passing the response back to the requester.

Where to use

  • Unified entry point for microservices.
  • \n
  • Authentication and Rate Limiting.
  • \n
  • Protocol translation.

Real World Example

Mobile App sends all requests to 'api.company.com'. The Gateway routes 'api/users' to User Service and 'api/orders' to Order Service.

Code Example

# Code Concept for API Gateway
# This pattern is architectural.

class Service:
    def execute(self):
        # Implementation logic
        pass