A query language for your API

History

  • Created in 2012 by Facebook
  • Released to the public in 2015
  • In 2018 the GraphQL project was moved from Facebook to the newly-established GraphQL foundation, hosted by the non-profit Linux Foundation

REST API

GraphQL

Schema & Type System

  • Strong type system
  • Schema defined using GraphQL Schema Definition Language (SDL)

type Post {
    title: String!
    author: Person!
}

type Person {
    name: String!
    nickName: String
    age: Int!
    posts: [Post!]!
}

type Query { 
    allPersons(last: Int): [Person!]!
}

type Mutation {
    createPerson(name: String!, age: Int!): Person!
}

type Subscription {
    newPerson: Person!
}

On to the code...

Made with Slides.com