Java application that consumes the Gutendex API to search, persist, and query books and authors using a PostgreSQL database.
- 🔍 Search books by title consuming the Gutendex external API
- 💾 Persist books and authors in PostgreSQL
- 📋 List all books stored in the database
- 👤 List all authors stored in the database
- 🗓 Query authors alive during a specific year
- 🌐 Filter books by language
src/
├── main/
│ ├── java/com/aluracursos/desafiob.../
│ │ ├── Principal/
│ │ │ └── Principal.java # Main menu & app flow
│ │ ├── dto/
│ │ │ ├── AuthorDTO.java
│ │ │ ├── BookDTO.java
│ │ │ └── GutendexResponse.java # API response mapping
│ │ ├── model/
│ │ │ ├── Author.java
│ │ │ ├── AuthorRepository.java
│ │ │ ├── Book.java
│ │ │ ├── BookRepository.java
│ │ │ ├── Datos.java
│ │ │ ├── DatosAutor.java
│ │ │ └── DatosLibros.java
│ │ ├── service/
│ │ │ ├── BookService.java
│ │ │ ├── ConsumoAPIlibros.java # Gutendex API consumer
│ │ │ ├── ConvierteDatos.java # JSON deserialization
│ │ │ └── IConvierteDatos.java # Conversion interface
│ │ └── DesafiobooksApiApplication.java
│ └── resources/
│ └── application.properties
- Java 17+
- PostgreSQL running locally
- Maven
# Clone the repository
git clone https://github.com/AbrahamVC-coder/Challenge-Literatura-API.git
cd Challenge-Literatura-APIConfigure your database in src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/literaturdb
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=updateRun the application:
mvn spring-boot:runThe app runs as an interactive console menu:
=== LITERATURA API ===
1 - Search book by title
2 - List registered books
3 - List registered authors
4 - List authors alive in a given year
5 - List books by language
0 - Exit
Example — Search a book:
Enter book title: Don Quijote
✔ Book found and saved: Don Quijote de la Mancha
Author: Miguel de Cervantes (1547 - 1616)
Language: es
Downloads: 25431
This project consumes Gutendex — a free REST API that provides metadata for over 70,000 public domain books from Project Gutenberg.
GET https://gutendex.com/books/?search={title}