Skip to content

kulkarni2u/graphql-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-boot and GraphQL demo

A simple Spring Boot app with GraphQL implementation using GraphQL-SPQR.

GraphQL SPQR - Makes it easy to add GraphQL API support to any Java Project.

How to use:

The app has GraphiQL embedded in it, all you need to do is run the app in your favourite IDE.

Query Example:

  1. A simple Query to get all the author names and their ids will look like this.
{
    allAuthors {
        id
        name
    }
}
  1. A more complex Query to get all the author names and the posts they wrote, will look like this.
{
    allAuthors {        
        name
        posts {
            content
            comments {
                content
            }
        }
    }
}

Mutation Example

  1. Create Author mutation will look something like this:
mutation {
  createAuthor(name: "William Shakespeare") {
    name
    id
  }
}

Visit How to GraphQL to learn more about GraphQL

Happy Coding!