Skip to content

Syemon/books-api

 
 

Repository files navigation

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:8082/graphiql

Sample query:

{
    findAllBooks {
        title
        isbn13
        yearOfPublication
        blurb
        publishers {
            name
        }
        isbn10
        authors {
            fullName
        }
        lang {
            name
        }
        genre {
            name
        }
        covers {
            pathToSmall
            pathToMedium
            pathToLarge
        }
        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.

About

GraphQL Books API

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%