Welcome to the Library Management System! This system allows users to manage books, authors, and rental transactions efficiently.
This application provides a backend system for managing a library's inventory and rental transactions. It allows users to perform CRUD operations on books and authors, as well as rent and return books.
- Add, view, update, and delete books and authors.
- Rent and return books with automatic tracking of rental periods.
- Error handling for invalid requests and missing resources.
- MongoDB integration for data storage.
- Clone the repository to your local machine:
git clone https://github.com/LokeshV790/Library_Management.git
- Navigate to the project directory:
cd Library_Management
- Make sure you have Java (version >= 8) and Maven installed.
- Set up a MongoDB instance locally or configure the application to connect to your MongoDB server.
- Update the
application.properties
file with your MongoDB connection details. - Build the project using Maven:
mvn clean install
- Run the application:
mvn spring-boot:run
Once the application is up and running, you can interact with it using HTTP requests. You can use tools like cURL, Postman, or any HTTP client to test the endpoints.
The application exposes the following endpoints:
/books
: Manage books (CRUD operations)./authors
: Manage authors (CRUD operations)./rentals
: Manage rental transactions (renting and returning books).
For detailed information on each endpoint and sample requests, refer to the API Documentation section below.
-
Create Book:
- Method: POST
- URL:
http://localhost:8080/books
- Body: JSON
{ "title": "Book Title", "author": "Author Name", "isbn": "978-1-234567-89-0", "publicationYear": 2022 }
-
Get Book by ID:
- Method: GET
- URL:
http://localhost:8080/books/<book_id>
-
Update Book:
- Method: PUT
- URL:
http://localhost:8080/books/<book_id>
- Body: JSON
{ "title": "Updated Book Title", "author": "Updated Author Name", "isbn": "978-1-234567-89-1", "publicationYear": 2023 }
-
Delete Book:
- Method: DELETE
- URL:
http://localhost:8080/books/<book_id>
-
Create Author:
- Method: POST
- URL:
http://localhost:8080/authors
- Body: JSON
{ "name": "Author Name", "biography": "Author Biography" }
-
Get Author by ID:
- Method: GET
- URL:
http://localhost:8080/authors/<author_id>
-
Update Author:
- Method: PUT
- URL:
http://localhost:8080/authors/<author_id>
- Body: JSON
{ "name": "Updated Author Name", "biography": "Updated Author Biography" }
-
Delete Author:
- Method: DELETE
- URL:
http://localhost:8080/authors/<author_id>
-
Rent Book:
- Method: POST
- URL:
http://localhost:8080/rentals
- Body: JSON
{ "bookId": "<book_id>", "renterName": "Renter Name" }
-
Return Book:
- Method: PUT
- URL:
http://localhost:8080/rentals/return/<rental_id>
Replace <book_id>
, <author_id>
, and <rental_id>
with the appropriate IDs for the specific resources you want to interact with. Additionally, ensure that your server is running on http://localhost:8080
or modify the URL accordingly.
Contributions are welcome! Feel free to submit bug reports, feature requests, or pull requests. Please adhere to the existing code style and guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.