A simple RESTful web service using Java and Spring Boot for a book management system. Users can perform various operations such as
- Create: Add a new book to the system.
- Read: Retrieve details of all books or a specific book by ID.
- Update: Modify details of an existing book.
- Delete: Remove a book from the system.
- Search Feature: An endpoint to search books by title or author.
License
To set up the BookHub application, follow these steps:
- Clone the repository:
git clone https://github.com/codecharlan/bookhub.git
- Navigate to the project directory:
cd bookhub
- Install the required dependencies using Maven:
mvn clean install
- Build the application
mvn clean package
Input and output data are formatted in JSON.
To begin using the BookHub Application, follow these steps:
- Start the application with:
The application will start on the default port (8080)
mvn spring-boot:run
The API exposes the following endpoints:
Endpoint | HTTP Method | Description |
---|---|---|
/api/users/register | POST | Creates a new user |
/api/users/login | POST | Logs in a user |
/api/users/logout | POST | Logs out a user |
/api/books/create | POST | Creates a new book |
/api/books/edit/{id} | PUT | Edits an existing book |
/api/books/{id} | GET | Retrieves a book by ID |
/api/books/search?searchTerm={searchTerm} | GET | Searches for books by title or author |
/api/books/all?pageSize={pageSize}&pageNumber={pageNumber} | GET | Retrieves all books |
/api/books/delete/{id} | DELETE | Deletes a book by ID |
/api/books/borrow/{id}?borrowCount={borrowCount} | POST | Borrows a book |
/api/books/return/{id}?returnCount={returnCount} | POST | Returns a borrowed book |
/api/books/purchase/{id}?purchaseCount={purchaseCount} | POST | Purchases a book |
/api/reviews/all | GET | Retrieves all reviews |
/api/reviews/1 | GET | Retrieves a review by ID |
/api/reviews/create?bookId={bookId} | POST | Creates a new review |
/api/reviews/edit/{id} | PUT | Updates a review |
/api/reviews/delete/{id} | DELETE | Deletes a review |
For comprehensive API usage details, refer to our Postman Documentation.
The BookHub application includes a set of unit tests to ensure the functionality of the application. To run the tests, use the following command:
mvn test
- Java 19
- SpringBoot
- Maven
- Spring Security
- Spring Data JPA
- Docker
- Lombok
- CI/CD
- Junit & Mockito
- Git and GitLab
- Postman
We welcome contributions to the BookHub project. If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Implement your changes and ensure that all tests pass.
- Commit your changes and push them to your forked repository.
- Submit a pull request to the main repository.
Please ensure that your code follows the existing coding style and conventions, and that you have added appropriate tests for your changes.
The BookHub application is licensed under the MIT License.
Feel free to reach out with any questions, feedback, or suggestions.