This project provides a RESTful API for managing a bookstore, allowing users to perform operations such as adding, retrieving, updating, and deleting book information.
- Database Schema: Utilizes a MySQL database to store book details, including title, author, ISBN, price, and quantity.
- API Endpoints: Provides endpoints for performing CRUD operations on books:
- Adding a new book
- Retrieving all books
- Retrieving a specific book by ISBN
- Updating book details
- Deleting a book
- Authentication: Implements basic authentication to restrict access to certain endpoints.
- Documentation: Includes Swagger for clear documentation of API endpoints and usage.
- Testing: Provides unit tests for the API endpoints to ensure functionality and handle edge cases and errors effectively.
- Flask: Python web framework for developing the RESTful API.
- Flask-SQLAlchemy: SQLAlchemy integration for database management.
- Flask-HTTPAuth: Library for implementing basic authentication in Flask applications.
- Flask-Swagger: Integration of Swagger/OpenAPI Specification for API documentation.
- MySQL: Relational database management system for storing book details.
-
Clone the repository:
git clone https://github.com/whitebeard10/RESTful-API-for-a-Bookstore-Management-System.git
-
Install dependencies:
pip install -r requirements.txt
- Set up the database:
- Configure the MySQL database URI in app.py.
- Ensure the database is created with the necessary table book.
- Run the application:
Navigate to application folder and run the file as:
python app.py
The API documentation is available in Swagger and can be accessed by running the application and visiting the Swagger UI endpoint (/apidocs) in a web browser.
Unit tests are included to ensure the correctness and reliability of the API endpoints. To run the tests, use the following command:
python test_app.py
Following is the postman link of the API testing:
This project uses the following license: 'MIT license'.