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

Introduction to GraphQL (Le Wagon Paris 2018)

Introduction to GraphQL (Le Wagon Paris 2018)

Avatar for Glenn Sonna

Glenn Sonna

November 30, 2017

Other Decks in Programming

Transcript

  1. { "data":[{ "title": "On iPhone X launch day, Apple draws

    a crowd", "content": "...", "description": "Today, the iPhone X ....", "pictureUrl": "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", "avatar": "https://tc.avatar.jc.jpg" } }] } api/posts?limit=25&type=trending GET
  2. { "data":{ "title": "On iPhone X launch day, Apple draws

    a crowd", "content": "...", "description": "Today, the iPhone X ....", "pictureUrl": "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", "avatar": "https://tc.avatar.jc.jpg" } } } api/posts/434 GET
  3. { "data":[{ "title": "On iPhone…", "content": "...", "description": "Today,", "pictureUrl":

    "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", "avatar": "https://tc.avatar.jc.jpg" } }] } On iPhone X today apple draws… Jordan Crook Snap has acquired Metamarkets for less than $100M… Ingrid Lunden Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings Lebanese Prime Minister Quits, Blaming Iran Jordan Crook !19 api/posts GET
  4. { "data":[{ "title": "On iPhone…", "content": "...", "description": "Today,", "pictureUrl":

    "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", "avatar": "https://tc.avatar.jc.jpg" } }] } On iPhone X today apple draws… Jordan Crook Snap has acquired Metamarkets for less than $100M… Ingrid Lunden Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings Lebanese Prime Minister Quits, Blaming Iran Jordan Crook !20 api/posts GET
  5. { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "author": { "name":

    "Jordan Crook", } }] } On iPhone X today apple draws… Jordan Crook Snap has acquired Metamarkets for less than $100M… Ingrid Lunden Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings Lebanese Prime Minister Quits, Blaming Iran Jordan Crook !21 api/posts GET
  6. !22 api/v1/posts { "data":[{ "title": "On iPhone…", "content": "...", "description":

    "Today,", "pictureUrl": "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", "avatar": "https://tc.avatar.jc.jpg" } }] } { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", } }] } api/v2/posts
  7. !23 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "author": { "name": "Jordan Crook", } }] } { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "comments": [], "recommends": [], "author": { "name": "Jordan Crook", } }] } { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "comments": [], "recommends": [], "author": { "name": "Jordan Crook", } }] } api/v2/posts GET
  8. !24 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "comments": [{ "content": "...", "author":{ "name": "Troll404", "picture": "http://superblog.troll404/jpg" } }], "recommends": [], "author": { "name": "Jordan Crook", } }] } { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "comments": [{ "content": "...", "author":{ "name": "Troll404", "picture": "http://superblog.troll404/jpg" } }], "recommends": [], "author": { "name": "Jordan Crook", } }] }
  9. !25 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 Mobile Desktop On iPhone X launch day, Apple draws a crowd Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 133 Troll210 Just a bunch of lunatics Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement a new infrastructure 32 50 133 Crypto42 I'm curious to see where Iran takes…
  10. !26 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "comments": [ "2N8HuE76", "34NHQU4i", ], "recommends": [], "author": { "name": "Jordan Crook", } }] }
  11. !27 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 { "data":[{ "title": "On iPhone…", "pictureUrl": "http://bit.ly/2zEHnfC", "comments": [ "/comments/2N8HuE76", "/comments/34NHQU4i", ], "recommends": [], "author": { "name": "Jordan Crook", } }] }
  12. !28 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 Mobile Desktop On iPhone X launch day, Apple draws a crowd Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 133 Troll210 Just a bunch of lunatics Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement a new infrastructure 32 50 133 Crypto42 I'm curious to see where Iran takes…
  13. !29 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 Mobile Desktop On iPhone X launch day, Apple draws a crowd Today, the iPhone X became available in Apple retail…. 28 14 133 Troll210 Just a bunch of lunatics Jordan Crook Iranian Government Plans New Infrastructure for Bitcoin Users… In positive news for Bitcoin users, the Iranian government plans to implement a new infrastructure 32 50 133 Crypto42 I'm curious to see where Iran takes… Lisa Froelings
  14. !30 On iPhone X launch day, Apple draws a crowd

    Jordan Crook Today, the iPhone X became available in Apple retail…. 28 14 Iranian Government Plans New Infrastructure for Bitcoin Users… Lisa Froelings In positive news for Bitcoin users, the Iranian government plans to implement 32 50 Mobile Desktop On iPhone X launch day, Apple draws a crowd Today, the iPhone X became available in Apple retail…. 28 14 133 Troll210 Just a bunch of lunatics Jordan Crook Iranian Government Plans New Infrastructure for Bitcoin Users… In positive news for Bitcoin users, the Iranian Best gear for long term travel Ashley Riley Building inclusive communities Amanda Seales In your network Trending
  15. GraphQL - Created by Facebook in 2012 - First open

    source draft in 2015 - Data Query language for your API - Platform, protocol and language agnostic
  16. Types type Post { title: String! content: String picture: String

    author: User! } type User { name: String! avatar: String } type Comment { content: String! author: User! } type Post { title: String! content: String picture: String author: User! comments: ?? } type Post { title: String! content: String picture: String author: User! comments: [Comment!]! }
  17. Types type Author { name: String! avatar: String } type

    Comment { content: String! author: User! } type Post { title: String! content: String picture: String author: User! comments: [Comment!]! }
  18. Types type Author { name: String! avatar: String } type

    Comment { content: String! author: User! } type Post { title: String! content: String picture: String author: User! comments: [Comment!]! }
  19. Schema type Author { name: String! avatar: String } type

    Comment { content: String! author: Author } type Post { title: String! content: String picture: String author: User! comments: [Comment!]! }
  20. Schema type Mutation { upvotePost(id: Int): [Post]! } type Query

    { post(id: Int): [Post]! posts(limit: Int!, type: String): [Post]! }
  21. schema type Mutation { upvotePost(id: Int): [Post]! } type Query

    { post(id: Int): [Post]! posts(limit: Int!, type: String): [Post]! }
  22. schema type Mutation { upvotePost(id: Int): [Post]! } type Query

    { post(id: Int): [Post]! posts(limit: Int!, type: String): [Post]! } schema { query: Query mutation: Mutation }