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

Getting Started with GraphQL

Jennifer Bland
October 20, 2018
130

Getting Started with GraphQL

GraphQL is a new API standard that provides a more efficient, powerful and flexible alternative to REST. At its core, GraphQL enables declarative data fetching where a client can specify exactly what data it needs from an API. Instead of multiple endpoints that return fixed data structures, a GraphQL server only exposes a single endpoint and responds with precisely the data a client asked for. In this talk, I will give you an introduction to GraphQL and then show you how to use it to access Github’s GraphQL API.

Jennifer Bland

October 20, 2018
Tweet

Transcript

  1. Three Truths and One Lie •I have visited 82 countries

    •I graduated from college before IBM introduced the IBM PC •My home is 400 sq ft •I have never been west of the Mississippi River
  2. 22 // GET ‘/graphql { projects {
 title image }

    } // result { projects {
 title: “Build a Fire Pit image: “firepit.png” } }
  3. 23

  4. 24

  5. 25

  6. Queries 29 query { relatedProjects { # this is an

    array title image details { description tools category }
  7. Resolvers 34 Post: { author(post) { return Users.find({ id: post.authorId})

    }, commentsCount(post) { return Comments.find({ postId: post.id}).count() } }
  8. Three Truths and One Lie •I have visited 82 countries

    •I graduated from college before IBM introduced the IBM PC •My home is 400 sq ft •I have never been west of the Mississippi River