This is a README file for the Bookstore application, a REST API built using Spring Boot, Java, MySQL as the database, and Hibernate. The application offers various functionalities for managing books, including creating, updating, deleting, and selecting books by ISBN or title. It also provides sorting capabilities based on price or any other parameter in any direction. Additionally, the application supports pagination, providing information about the total number of elements, the current page number, and whether it is the last page.
To run the Bookstore application locally, follow the instructions below:
- Java Development Kit (JDK) version 11 or higher
- MySQL database
- Please follow the following steps: https://www.javatpoint.com/spring-boot-download-and-install-sts-ide
- Clone the repository: git clone https://github.com/Ashirvad121/Bookstore
- Import the project into STS: Click File > Import... • Select Maven > Existing Maven Projects and click Next • Browse to the project directory and click Finish •
- Update the values in application.properties with your MySQL database connection details.
- Run the app: Right-click the project in the Package Explorer and click Run As > Spring Boot App.
The application will start running on http://localhost:8888
.
The Bookstore API provides the following endpoints:
POST /registerbook
- Create a new bookPUT /books/{id}
- Update a book by its IDDELETE /books/{id}
- Delete a book by its IDGET /bookbyisbn/{isbn}
- Get a book by its ISBNGET /bookbytitle/{name}
- Get books by their titleGet /bookbyauthor/{author}
- Get books by their authorGET /allBook?sortBy={any parameter}&sortDir={asc|desc}&pageSize={any interger value}&pageNo={any interger value}
- Get books sorted by a specified field (e.g.,price
) and direction (ascending or descending) and you can also change the page size and page numberPut /updatebook
- To update bookDelete /deletebook/{isbn}
- To delete book useing ISBN
Note: Replace {id}
, {isbn}
, {title}
, {field}
, {asc|desc}
, {page}
, and {size}
with the actual values.
The Bookstore application uses a MySQL database to store book information. The database schema consists of a single table named books
with the following columns:
id
(integer) - The unique identifier of the bookisbn
(integer) - The ISBN number of the booktitle
(string) - The title of the bookauthor
(string) - The author of the bookprice
(integer) - The price of the bookdescription (description)
- Description of the bookpublishDate (Date)
- When the book was publishedstatus (boolean)
- currently the book is available or not
The Bookstore application utilizes the following technologies:
- Spring Boot - Java framework for building the REST API
- Java - The programming language used for the application
- MySQL - Relational database management system
- Hibernate - Object-relational mapping tool for database operations
This project is licensed under the MIT License.