/graphql-server-java-starter

Basic GraphQL server using graphql-java, Spring, and MongoDB

Primary LanguageJava

GraphQL Server Java

Running Locally

  1. Expects mongod to be running @ localhost:27017
  2. Data will be seeded into book and author collections when the app starts up
  3. Run com.davidagood.graphql.GraphQLServerApplication or manually run ./gradlew bootRun
  4. Starts @ http://localhost:8080
  5. Run a query by checking an id logged at start-up, filling it into one of the queries below, and requesting POST http://localhost:8080/graphql with the query in the request body
  6. Alternatively, use a GraphQL client or GraphQL Playground to send the query
{
    book(id: "<BOOK_ID_HERE>") {
        id
        name
        pageCount
        author {
            firstName
            lastName
        }
    }
}
{
    author(id: "<AUTHOR_ID_HERE>") {
        id
        firstName
        lastName
    }
}