This is a Flask-based API for retrieving puzzle data. The API supports filtering and pagination, and it includes caching for better performance.
Retrieve a list of puzzles with optional filters and pagination.
- start (integer, default: 0) - The starting index for pagination.
- limit (integer, default: 10) - The number of puzzles to return.
- min_rating (integer, default: 0) - The minimum rating to filter puzzles.
- max_rating (integer, default: 3000) - The maximum rating to filter puzzles.
- themes (string) - A comma-separated list of themes to filter puzzles.
https://chess-puzzles-api.vercel.app/puzzles?start=0&limit=10&min_rating=1000&max_rating=2000&themes=adventure,logic
Retrieve a puzzle by its ID.
- puzzle_id (string) - The ID of the puzzle to retrieve.
https://chess-puzzles-api.vercel.app/puzzle?puzzle_id=12345
- Python 3.x
- Flask
- Flask-Caching
- pandas
-
Clone the repository:
https://github.com/Ali-Raza764/chess_puzzles_api cd YOUR_REPOSITORY_NAME
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Ensure you have a
puzzles.csv
file in the root directory of your project.
-
Run the Flask app:
flask run
-
Open your browser and go to
http://127.0.0.1:5000
to view the API documentation.
For deployment, you can use services like Heroku, AWS, or any other cloud provider. Ensure you have the necessary environment variables set up and a production-ready server configuration.
This project is licensed under the MIT License - see the LICENSE file for details.