Skip to content

Latest commit

 

History

History
129 lines (112 loc) · 1.21 KB

README.md

File metadata and controls

129 lines (112 loc) · 1.21 KB

GraphQL commands

Query

Query links

query {
  links {
    id
    description
    url
  }
}

Query Users

query {
  users {
    id
    username
    password
  }
}

Query Votes

query {
  votes {
    id
    user {
      id
      username
    }
    link {
      id
      url
    }
  }
}

Query with filter

query {
  links(search: "schlpbch") {
    id
    description
    url
  }
}

Mutate

Create link:

mutation {
  createLink(
    url: "https://github.com",
    description: "Where the world builds software"
  ) {
    id
    description
    url
  }
}
mutation {
  createLink(
    url: "https://github.com/schlpbch",
    description: "Schlpbch's GitHub"
  ) {
    id
    description
    url
    postedBy {
      id
      username
      email
    }
  }
}

Create user:

mutation {
  createUser(
    username: "schlpbch",
    email: "[email protected]",
    password: "424242"
  ) {
    user {
      id
      username
      email
    }
  }
}

Create Vote

mutation {
  createVote(linkId: 1) {
    user {
      id
      username
      email
    }
    link {
      id
      description
      url
    }
  } 
}