Graphql demo with apollo client at server side.
step 1 - npm i
step 2 - npm start
make sure that mongodb is running for crud operation
mutation saveUser {
createUser(firstName: "Your firsName", lastName: "Your lastName") {
_id
firstName
lastName
}
}
query getAllUser {
allUsers {
_id
firstName
lastName
}
}
query getAllPost {
allPost {
_id
user
title
description
}
}
mutation savePost {
createPost(user: "userId", title: "Learn graphql", description: "its easy to learn Graphql and very use full too.") {
user
_id
title
description
}
}
query userWithpost{
allUserWithPost{
title
description
user{
lastName
firstName
}
}
}
you can find resolver in /resolver/user directory
Input , output schema is define in /schema/user