java-tutorials/spring-boot-modules/spring-boot-graphql
Haroon Khan bf719b41aa [JAVA-15376] Update for Graphql Postman article (#12853)
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
2022-10-12 21:17:10 +05:30
..
src [JAVA-15353] Update code for GraphQL vs REST article (#12849) 2022-10-12 21:08:39 +05:30
GraphQL collection.postman_collection.json [JAVA-14663] Update Graphql code for Boot 2.7.x changes and move to new module (#12729) 2022-10-07 22:51:41 +05:30
README.md [JAVA-15376] Update for Graphql Postman article (#12853) 2022-10-12 21:17:10 +05:30
pom.xml [JAVA-14660] Update code for Graphql error handling (#12839) 2022-10-11 00:46:12 +05:30

README.md

Spring Boot Graphql

This module contains articles about Spring Boot Graphql

The Course

The "REST With Spring" Classes: http://bit.ly/restwithspring

Relevant Articles:

GraphQL sample queries

Query

curl \
--request POST 'localhost:8080/graphql' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query {\n    recentPosts(count: 2, offset: 0) {\n        id\n        title\n        author {\n            id\n            posts {\n                id\n            }\n        }\n    }\n}"}'

Mutation

curl \
--request POST 'localhost:8080/graphql' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"mutation {\n    createPost(title: \"New Title\", authorId: \"Author2\", text: \"New Text\") {\n id\n       category\n        author {\n            id\n            name\n        }\n    }\n}"}'