A simple backend CRUD application for managing book categories and books.
- Create, read, update, and delete book categories.
- Create, read, update, and delete books.
- Establish a one-to-many relationship between categories and books (one category can have many books).
- Ensure that each book belongs to exactly one category.
- Java: Backend language.
- Spring Boot: Framework for building Java applications.
- Spring Data JPA: For database interaction.
- MySQL: Relational database management system.
- H2 Database: Relational database management system for tests.
- Maven: Build and dependency management.
- Clone this repository.
- Set up your MySQL database.
- Configure the database connection in
application.properties
. - Run the application using Maven:
mvn spring-boot:run
.
-
Categories:
GET /api/categorias
: Get a list of all categories.GET /api/categorias/{categoryId}
: Get details of a specific category.POST /api/categorias
: Create a new category.PUT /api/categorias/{categoryId}
: Update an existing category.DELETE /api/categorias/{categoryId}
: Delete a category.
-
Books:
GET /api/livros?categoria={categoryId}
: Get a list of all books of a specific category.GET /api/livros/{bookId}
: Get details of a specific book.POST /api/livros?categoria={categoryId}
: Create a new book in a specific category.PUT /api/livros/{bookId}
: Update an existing book.DELETE /api/livros/{bookId}
: Delete a book.
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open a pull request or submit an issue.