This repository contains two APIs, one built with Python (Flask) and the other with Node.js (TypeScript and Express). Both APIs are configured with Docker Compose to restart every 10 seconds, simulating timeouts or data loss scenarios. Circuit Breaker patterns are implemented to handle failures gracefully.
- Docker
- Docker Compose
- Clone the repository:
git clone https://github.com/pazfelipe/circuit-broker.git
cd circuit-broker
docker-compose up --build -d
- Build and start the services:
docker-compose up --build -d
• /status - Returns the status of the Python API. • /data - Returns a sample data from the Python API. • /node-data - Fetches data from the Node.js API using a Circuit Breaker.
• /status - Returns the status of the Node.js API. • /data - Returns a sample data from the Node.js API. • /python-data - Fetches data from the Python API using a Circuit Breaker.
cd python_api
pytest
cd node_api
npm test
Both APIs implement the Circuit Breaker pattern to handle failures gracefully and prevent cascading failures across services.
Python API
Uses the pybreaker library.
Node.js API
Uses the opossum library.