create_auto_router

Function create_auto_router 

Source
pub async fn create_auto_router(
    amqp_url: impl Into<String>,
) -> Result<Router, RabbitMeshError>
Expand description

Create the auto-router that handles all REST API calls

ยงHow it works:

  1. Frontend sends HTTP request to gateway
  2. Gateway parses the request and extracts service/method
  3. Gateway calls microservice via RabbitMQ (NO PORTS!)
  4. Microservice processes request and responds via RabbitMQ
  5. Gateway returns HTTP response to frontend

Example flow:

Frontend -> GET /api/v1/user-service/users/123
         -> Gateway extracts: service="user-service", method="get_user", params={id: 123}
         -> Gateway calls service via RabbitMQ
         -> user-service processes request 
         -> user-service responds via RabbitMQ
         -> Gateway returns JSON to frontend