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:
- Frontend sends HTTP request to gateway
- Gateway parses the request and extracts service/method
- Gateway calls microservice via RabbitMQ (NO PORTS!)
- Microservice processes request and responds via RabbitMQ
- 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