GraphQL Playground

01 Hello

node server.js
query {
  greeting
}

02 Job Board

Server

npm start

Client

npm start

Queries

  • Get Jobs
query {
  jobs {
    id
    title
    company {
      id
      name
    }
  }
}
  • Get Job
query JobQuery($id: ID!) {
  job(id: $id) {
    ...JobDetail
  }
}

fragment JobDetail on Job {
  id
  title
  company {
    id
    name
  }
  description
}

Variables

{
 "id": "J-ONE"
}
  • Get Company
query ComapnyQuery($id: ID!) {
  company(id: $id) {
    id
    name
    description
    jobs {
      id
      title
    }
  }
}

Variables

{
 "id": "C-ONE"
}

Mutations

  • Create Job
mutation CreateJob($input: CreateJobInput) {
  job: createJob(input: $input) {
    id
    title
    company {
      id
      name
    }
    description
  }
}

Variables

{
 "input": {
   "title": "New Job",
   "description": "This is a new Job"
 }
}

Headers

{
  "authorization": "Bearer <YOUR TOKEN>"
}

03 Chat

Server

npm start

Client

npm start

Subscription

subscription {
  messageAdded {
    id
    from
    text
  }
}