Skip to content

Spring boot project demonstrating GraphQL capabilities

Notifications You must be signed in to change notification settings

abhilash28abhi/spring-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-graphql

Spring boot project demonstrating GraphQL capabilities

To access h2-console use:

  1. http://localhost:8080/h2/

To access GraphQl query UI tool:

  1. http://localhost:8080/graphiql

To fetch the product details for a given product Id , the GraphQl query would be:

{
  product(id: "1") {
    id
    title
    shortDesc
    listPrice
    reviews {
      reviewTitle
      reviewText
    }
  }
}

To Access only selected fields from the product pass the field names accordingly in the query:

{
  product(id: "1") {
    id
    title
    shortDesc
    listPrice
  }
}
  1. We can also pass the GraphQl query in encoded format and be used in controller for a given use-case: http://localhost:8080/graphql?query=%7Bproduct%28id%3A%221%22%29%7BidtitleshortDesclistPrice%7D%7D which is human equivalent for http://localhost:8080/graphql?query={product(id:"1"){idtitleshortDesclistPrice}}

About

Spring boot project demonstrating GraphQL capabilities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages