GraphQL books API made using Spring Boot and DGS. This is a sibling project of the Book Project.
Prerequisites:
- JDK 11 or higher
- Configure Lombok
- PostgreSQL 12 or (better) Docker
- For Linux users, install docker-compose
- For macOS and Windows users, install Docker Desktop
Recommended IntelliJ plugin: JS GraphQL
- Import as a Maven project into your favourite IDE
- Start the PostgreSQL Database or run the docker-compose file
docker-compose up -d
(you may need to addsudo
to this command)- If using macOS or Windows, you'll need to first ensure Docker Desktop is running
- Run
BooksApiApplication.java
- You may need to build the project first if you're seeing 'com.acme' (DGS codegen) errors
- Go to
localhost:8080/graphiql
Sample query:
{
findAllBooks {
title
isbn13
yearOfPublication
blurb
publisher {
name
}
isbn10
authors {
fullName
}
lang {
name
}
genre {
name
}
cover {
small
medium
large
}
publishingFormat {
formatName
}
}
}
To access the PostgreSQL database when docker-compose/Docker desktop is running, use the follow credentials in your favourite client:
- Host:
localhost
- Port:
5432
- User:
dbuser
- Password:
dbpassword
- Database: books_api
- URL:
jdbc:postgresql://localhost:5432/books_api
For example, in IntelliJ ultimate or DataGrip:
If you wish to contribute (thanks!), please first see the contributing document.