Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Exploring GraphQL

Exploring GraphQL

Marc-Andre Giroux

March 09, 2017
Tweet

More Decks by Marc-Andre Giroux

Other Decks in Programming

Transcript

  1. @__xuorig__ { "name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color":

    "blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "http://swapi.co/api/ planets/1/", "films": [ "http://swapi.co/api/films/6/", "http://swapi.co/api/films/3/", "http://swapi.co/api/films/2/", "http://swapi.co/api/films/1/", "http://swapi.co/api/films/7/" ],
  2. @__xuorig__ { "name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color":

    "blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "http://swapi.co/api/ planets/1/", "films": [ "http://swapi.co/api/films/6/", "http://swapi.co/api/films/3/", "http://swapi.co/api/films/2/", "http://swapi.co/api/films/1/", "http://swapi.co/api/films/7/" ],
  3. @__xuorig__ "data": { "film": { "title": "A New Hope", "characters":

    [ { "name": "Luke Skywalker" }, { "name": "Princess Leia" } ] } }
  4. @__xuorig__ { film(id: "123") { title characters { name }

    } } type QueryRoot { film(id: ID!): Film }
  5. @__xuorig__ { film(id: "123") { title characters { name }

    } } type Film { title: String! characters: [Character!]! }
  6. @__xuorig__ { film(id: "123") { title characters { name }

    } } type Character { name: String! }
  7. @__xuorig__ query { film(id: "123") { title characters { name

    } } bestRatedfilm { title characters { name } } }
  8. @__xuorig__ query { film(id: "123") { title characters { name

    } } bestRatedfilm { title characters { name } } }
  9. @__xuorig__ query { film(id: "123") { ...filmFragment } bestRatedfilm {

    ...filmFragment } } fragment filmFragment on Film { title characters { name } }