https://github.com/jesperancinha/guitar-shop
Exploring GraphQL
https://github.com/jesperancinha/guitar-shop
apollo apollo-client apollo-kotlin gradle graphql java jdk jre jvm kotlin maven spring spring-graphql
Last synced: 5 months ago
JSON representation
Exploring GraphQL
- Host: GitHub
- URL: https://github.com/jesperancinha/guitar-shop
- Owner: jesperancinha
- License: apache-2.0
- Created: 2024-11-08T16:15:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-19T11:30:25.000Z (9 months ago)
- Last Synced: 2025-12-22T04:11:21.486Z (9 months ago)
- Topics: apollo, apollo-client, apollo-kotlin, gradle, graphql, java, jdk, jre, jvm, kotlin, maven, spring, spring-graphql
- Language: Kotlin
- Homepage: https://joaofilipesabinoesperancinha.nl
- Size: 361 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Making a query
- http://localhost:8080/graphiql?path=/graphql
## Query examples
#### Get all guitars
```graphql
query getGuitar {
guitarById(id: 1) {
id
brand
model
owner {
id
firstName
lastName
}
}
}
```
```shell
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "query getGuitar { guitarById(id: 1) { id brand model owner { id firstName lastName } } }"
}'
```
```graphql
query getGuitar {
guitarById(id: 1) {
id
model
owner {
id
lastName
}
}
}
```
```shell
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ allUsers { id name age } }"}'
```
```graphql
query getOwner {
ownerById(id: 1) {
id
lastName
}
}
```
```shell
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "query getOwner { ownerById(id: 1) { id lastName } }"
}'
```
#### All users
```graphql
mutation {
createUser(name: "Black Raven", age: 30) {
id
name
age
}
}
```
```graphql
query {
allUsers {
id
name
age
}
}
```
```shell
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "query allUsers { id name age }"
}'
```
## Resources
- https://spring.io/guides/gs/graphql-server
- https://www.apollographql.com/docs/kotlin/tutorial/04-execute-the-query
- https://plugins.jetbrains.com/plugin/8097-graphql
## About me
[](https://github.com/jesperancinha)