luanpersini / NodeJS-GraphQL

Basic GraphQL project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NodeJS GraphQL

  • Query: retrieve information

  • Mutations: create, update, delete (mutate the backend)

  • Query fields are executed in parallel, mutation fields run in series, one after the other.

Mutations

We can use graphQL Alias to run multiple mutations.

  • Mutations
mutation {    
  aliasOne: createUser(
    name: "Any Name", email: "any_email@mail.com", phone:"111-111"
  ){id, name, email, phone}  
  
  aliasTwo: createUser(
    name: "Any Name 2", email: "any_email2@mail.com"
  ){id, name, email}    
}
  • Result
{
  "data": {
    "aliasOne": {
      "id": "616cec1d3be90c37fce8898c",
      "name": "Any Name",
      "email": "any_email@mail.com",
      "phone": "111-111"
    },
    "aliasTwo": {
      "id": "616cec1d3be90c37fce8898e",
      "name": "Any Name 2",
      "email": "any_email2@mail.com"
    }
  }
}

About

Basic GraphQL project


Languages

Language:JavaScript 100.0%