A RESTful API for managing book reviews, allowing users to create, read, update, and delete books and their associated reviews.
- Create, read, update, and delete books
- Add, update, and delete reviews for specific books
- H2 in-memory database for quick setup and testing
- Swagger documentation for easy API exploration
- Java - Programming language
- Spring Boot - Framework for building the API
- Spring Data JPA - Simplifies database access
- H2 Database - In-memory database for development and testing
- Lombok - Reduces boilerplate code
- Swagger - API documentation and testing interface
- Clone the repository:
git clone https://github.com/regis-mugisha/book-review-api.git
- Navigate to the project directory:
cd book-review-api
- Build the project using Maven:
mvn clean install
- Run the application:
mvn spring-boot:run
-
Once the application is running, you can access the API documentation at: http://localhost:8080/api-docs
-
You can also explore the API using Swagger UI at: http://localhost:8080/swagger-ui.html
- Get all books
GET /api/v1/books
- Get book by ID
GET /api/v1/books/{bookId}
- Create a new book
POST /api/v1/books
- Update a book
PUT /api/v1/books/{bookId}
- Delete a book
DELETE /api/v1/books/{bookId}
- Get all reviews for a book
GET /api/v1/books/{bookId}/reviews
- Add a review to a book
POST /api/v1/books/{bookId}/reviews
- Update a review
PUT /api/v1/books/{bookId}/reviews/{reviewId}
- Delete a review
DELETE /api/v1/books/{bookId}/reviews/{reviewId}
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a Pull Request.