Skip to content

Latest commit

 

History

History
91 lines (74 loc) · 2.94 KB

README.md

File metadata and controls

91 lines (74 loc) · 2.94 KB

Logo

Build Status Code coverage Slack

GraphQL books API made using Spring Boot and DGS. This is a sibling project of the Book Project.

Setup

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

Running the app

  1. Import as a Maven project into your favourite IDE
  2. Start the PostgreSQL Database or run the docker-compose file docker-compose up -d (you may need to add sudo to this command)
    • If using macOS or Windows, you'll need to first ensure Docker Desktop is running
  3. Run BooksApiApplication.java
    • You may need to build the project first if you're seeing 'com.acme' (DGS codegen) errors
  4. 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
        }
    }
}

Access database

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:

image

Contributing

If you wish to contribute (thanks!), please first see the contributing document.