This document provides an overview of the implementation details for each requirement outlined in the take-home test for the online bookstore RESTful API.
This project implements a simple RESTful API for an online bookstore using Java with the Spring Boot framework. The API allows users to perform CRUD (Create, Read, Update, Delete) operations on books in the store and manage their availability status.
-
Java with Spring Boot Framework: The API is developed using Java with the Spring Boot framework. Spring Boot offers a simplified development experience, providing auto-configuration and dependency management out of the box.
-
- View Books: Implemented GET /api/v1/books endpoint to retrieve a list of available books.
- Add Books: Added POST /api/v1/books endpoint to allow users to add new books to the store.
- Update Book Details: Implemented PUT /api/v1/books/{id} endpoint for updating book details.
- Delete Books: Added DELETE /api/v1/books/{id} endpoint to delete books from the store.
Each endpoint supports JSON request and response formats.
-
Relational Database: Utilized MySQL as the relational database for storing book data. MySQL provides a robust and scalable solution for managing relational data
-
JPA for Database Interactions : Used SpringDataJPA an implementation of the Java Persistence API for database interactions, providing an object-relational mapping solution for managing entities.
Implemented error handling mechanisms to return appropriate HTTP status codes and error messages in case of invalid requests or errors. This ensures clarity and ease of troubleshooting for clients consuming the API.
Developed a suite of unit tests to validate the functionality of the API endpoints logic and ensure correctness under various scenarios. Unit tests had a coverage of over 70%.
Authentication: Authentication can be added to API endpoints for enhanced security. This was implemented with Spring Security module, using JWT tokens as the means of authorisation while username/password for authentication.
- Clone the repository to your local machine:
git clone [email protected]:masterscode/BookFindar.git
- Navigate to project directory
cd BookFindar
- Build and run the project using Docker:
docker-compose up --build
- The API will be accessible at
http://localhost:8080/api/v1/book
Please note that a default user is seeded during application first run. The user log-in credentials are
{
"username": "[email protected]",
"password": "password"
}
Thank you for reviewing the implementation of the online bookstore RESTful API. If you have any further questions or require additional information, please feel free to reach out.