- To start the server simply run the command "npm run start:dev"
- The project includes dummy data
- When performing update mutations you don't need to provide all arguments.
- Query for all users and their posts:
query {
users {
name
description
id
posts {
title
content
id
}
}
}- Query for a specific user and their posts:
query {
user(id: "1") {
name
id
description
posts {
title
content
id
}
}
}- Query all posts and their authors:
query {
posts {
title
content
id
user {
name
id
description
}
}
}- Query a specific post and it's author:
query {
post(id: "1") {
title
content
id
user {
name
id
description
}
}
}- Create user:
mutation {
userCreate(user: { name: "New user", description: "New description" }) {
user {
name
id
description
posts {
title
}
}
userErrors {
message
}
}
}- Update user:
mutation {
userUpdate(id: "1", user: { name: "Viggo Updated", description: "Updated description" }) {
userErrors {
message
}
user {
description
id
name
posts {
title
content
}
}
}
}- Delete user:
mutation {
userDelete(id: "1") {
user {
name
id
description
posts {
title
content
}
}
userErrors {
message
}
}
}- Create a new post:
mutation {
postCreate(post: { title: "New post", content: "New content", authorId: "2" }) {
post {
title
content
id
user {
name
description
id
}
}
userErrors {
message
}
}
}- Update post:
mutation {
postUpdate(post: { title: "New title", content: "New content", authorId: "2" }, id: "1") {
userErrors {
message
}
post {
title
id
content
user {
name
id
}
}
}
}- Delete post:
mutation {
postDelete(id: "1") {
userErrors {
message
}
post {
title
content
id
user {
name
id
}
}
}
}