Coder Social home page Coder Social logo

nodejs-graphql-yoga's Introduction

https://immense-thicket-72966.herokuapp.com/

Users

Get Users - Query

query{
  users{
    id
    name
    email
    comments{
      id
      text
    }
    posts{
      id
      title
    }
  }
}

Create User

mutation{
  createUser(data:{ name: "Mario", email: "[email protected]",age:33 })
  {
    id
    name
    email
    age
    posts{
      id
    }    
  }
}

Update User

mutation{
  updateUser(id:"1", data:{
    name: "Mike",
    email: "[email protected]"
    age: 18
  }){
    id
    name
    email
    age
  }
}

Delete User

mutation{
  deleteUser(id: "1"){
    id
  }
}

Comments

Get Comments - Query

query{
  comments{
    id
    text
    author{
      name
    }
  }
}

Subscription Comment

subscription{
  comment(postId: "2"){
    mutation
    data{
    id
    text
    author{
      id
      name
    }
    }
  }
}

mutation{
  createComment(data:{
    text: "A comment", author:"1", post: "2"
  }){
    id
    text
    author{
      name
    }
    post{
      title
    }
  }
}

mutation{
  updateComment(id:"c4f76db4-c334-4b40-8bbf-48423a5dc0cd",
    data:{ text:"This is my new comment updated"}
  ){
    id
    text
  }
}

Create Comment

mutation{
  createComment(data:{
    text: "A comment", author:"1", post: "1"
  }){
    id
    text
    author{
      name
    }
    post{
      title
    }
  }
}

Update Comment

mutation{
  updateComment(id:"b2d9d99a-f141-4576-96c4-7f4eb1cddeb2",
    data:{ text:"New text"}
  ){
    id
    text
  }
}

Delete Comment

mutation{
  deleteComment(id: "102"){
    id
  }
}

Posts

Get Posts - Query

query{
  posts{
    id
    title
    author{    
      name      
    }
  }
}

Subscription edit Post

subscription{
  post{
    mutation
    data{
      id
      title
      body
      author{
        id
        name
      }      
    }
  }
}

mutation{
  updatePost(
    id: "2", 
    data: 
    { 
      title: "New title",
      published: true
    }
  ){
    id
    title
    body
    published
  }
}

Subscription delete Post

subscription{
  post{
    mutation
    data{
      id
      title
      body
      author{
        id
        name
      }      
    }
  }
}

mutation{
  deletePost(id:"3"){
    id
    title
    body
    published
  }
}

Subscription Post

subscription{
  post{
    mutation
    data{
      id
      title
      body
      author{
        id
        name
      }      
    }
  }
}

mutation{
  createPost(data:{
    title: "New Post",
    body:"New Body",
    published:true,
    author: "3"
  }){
    id
    title
    body
    published
    author{
      name
    }
  }
}

Create Post

mutation{
  createPost(data:{
    title: "New Post",
    body:"New Body",
    published:true,
    author: "3"
  }){
    id
    title
    body
    published
    author{
      name
    }
  }
}

Update Post

mutation{
  updatePost(
    id: "2", 
    data: 
    { 
      title: "New title",
      published: true
    }
  ){
    id
    title
    body
    published
  }
}

Delete Post

mutation{
  deletePost(id:"3"){
    id
    title
    body
    published
  }
}

Subscription Example

subscription{
  count
}

nodejs-graphql-yoga's People

Contributors

eduardoguerrero avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.