This is a Spring Boot microservice for managing book-related operations. It includes RESTful API endpoints for CRUD operations on book data, such as creating, updating, retrieving, and deleting book records.
- REST API for book management.
- CRUD operations.
- Spring Boot framework.
- Maven build system.
- H2 in-memory database (default) for development.
- Docker support.
- Java 21 or higher
- Maven 3.8.8+
- Docker (optional, for containerization)
-
Clone the repository:
git clone https://github.com/victorhtorres/book-service.git cd book-service -
Build the project using Maven:
mvn clean install
-
Run the application using Maven:
mvn spring-boot:run
-
Access the API at
http://localhost:8080.
To build and run the application as a JAR file:
-
Package the application:
mvn clean package
-
Run the JAR file:
java -jar target/book-service-1.0.0.jar
-
Build the Docker image:
docker build -t book-service . -
Run the Docker container:
docker run -p 8080:8080 book-service
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/books |
Retrieve all books |
| GET | /api/v1/books/{id} |
Retrieve a specific book |
| POST | /api/v1/books |
Create a new book |
| PUT | /api/v1/books/{id} |
Update an existing book |
| DELETE | /api/v1/books/{id} |
Delete a book |
By default, the project uses an in-memory H2 database for local development. You can access the H2 console at http://localhost:8080/h2-console (username: sa, password: empty).
To configure a persistent database, update the application.properties file with your preferred database settings.
To run the unit and integration tests, use the following command:
mvn testThis project is licensed under the MIT License. See the LICENSE file for more details.
You can adjust this README.md according to specific details in the project, such as additional setup, configurations, or important notes for deployment.