A RESTful API that provides random quotes. This project demonstrates backend development with Python (Flask) and CI/CD automation using Jenkins and Docker.
- Fetch all quotes: Retrieve a list of all available quotes.
- Fetch a random quote: Get a random quote from the collection.
- Fetch a specific quote by ID: Query a specific quote using its unique identifier.
- Python: Backend logic and API implementation.
- Flask: Lightweight web framework for building the API.
- Jenkins: CI/CD pipeline automation.
- Docker: Containerization for application deployment.
Endpoint | Method | Description |
---|---|---|
/api/quotes |
GET |
Get all quotes |
/api/quotes/random |
GET |
Get a random quote |
/api/quotes/<id> |
GET |
Get a quote by its ID |
To set up the project locally:
- Clone the Repository:
git clone https://github.com/AdetokunAdenike/random-quote-api.git cd random-quote-api
- Create a Virtual Environment (Recommended):
python3 -m venv env source env/bin/activate
- Install Dependencies:
pip install -r requirements.txt
- Run the Application:
python app.py
- Access the API: Open your browser or use a tool like curl or Postman to interact with the API at:
http:127.0.0.1:5000
To run the application in a Docker container:
- Build the Docker Image:
docker build -t random-quote-api .
- Run the Docker Container:
docker run -d -p 5000:5000 random-quote-api
- Access the API: Visit:
http://127.0.0.1:5000
- CI/CD Automation: Implemented using jenkins.
- Pipeline Stages:
- Checkout Code: Pulls the latest code from the repository.
- Build Docker Image: Creates a Docker image of the application.
- Run Unit Tests: Executes automated tests to ensure code quality.
- Deploy Application: Deploys the Docker container.
- To run unit tests:
pytest
This project is licensed under the MIT Licence.