Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example queries and mutations #11

Open
marktani opened this issue Dec 2, 2017 · 0 comments
Open

Example queries and mutations #11

marktani opened this issue Dec 2, 2017 · 0 comments

Comments

@marktani
Copy link
Contributor

marktani commented Dec 2, 2017

server

# first, we'll receive an empty feed
query emptyFeed {
  feed {
    id
  }
}

# let's signup! we'll store the received token in the a new 'Authorization: Bearer <token>' header
mutation signup {
  signup(
    email: "nilan@graph.cool"
    password: "default"
    name: "Nilan"
  ) {
    token
    user {
      id
      posts {
        id
      }
    }
  }
}

# let's create our first post! make sure to set the Authorization header correctly
mutation createPost {
  writePost(
    title: "Why GraphQL will change your life!"
    text: "Rest in pieces"
  ) {
    id
  }
}

db

# we'll see the new post, but it's not published yet
query getPosts {
  allPosts {
    id
    isPublished
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant