java-tutorials/spring-boot-modules/spring-boot-graphql
Bipin kumar 74686f60a0 JAVA-21189: changes made for formatting modules starting from S (#14106) 2023-05-24 19:37:51 +05:30
..
src Feature/bael 5756 choose api (#13227) 2023-01-03 13:52:58 +00:00
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 Update README.md 2022-12-07 19:35:24 +08:00
pom.xml JAVA-21189: changes made for formatting modules starting from S (#14106) 2023-05-24 19:37:51 +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}"}'