Loading
Mathis Hofer
This is a live streamed presentation. You will automatically follow the presenter and see the slide they're currently on.
Puzzle Tech Workshop 2018
Introduction
Build a GraphQL service with GraphQL.js
Open hacking
Developed by Facebook 2012
Public release 2015
GraphQL.js (reference implementation) = MIT License
Specification:
Servers
C# / .NET
Clojure
Elixir
Erlang
Go
Groovy
Java
JavaScript
PHP
Python
Scala
Ruby
Clients
C# / .NET
Clojurescript
Go
Java / Android
JavaScript
Swift / Objective-C iOS
Python
Strongly typed schema
Clients define the structure of the data required
Rich open-source ecosystem
Cross-platform
Integrates in existing code and data
Introspective
Extract trees from the app data graph
Source: https://blog.apollographql.com/graphql-explained-5844742f195e
...an application-layer protocol
...a query language for your API
...a server-side runtime for executing queries
...a type system you define for your data
...a graph database
...tied to any specific database or storage engine
Source: https://graphql.org/learn/thinking-in-graphs/
Reading data = Queries
Writing data = Mutations
Realtime updates = Subscriptions
Send HTTP requests
Complex clients (e.g. Relay):
Automatically handle batching, caching, and other features
Either:
GET (query string)
Or:
POST (JSON body)
JSON body:
{
"data": { ... },
"errors": [ ... ]
}REST = architectural concept
GraphQL = query language, specification and collection of tools
REST = leverages HTTP
GraphQL = invents own conventions
REST = resources
GraphQL = entity graph
REST = entities identified by URLs
GraphQL = single endpoint /graphql
REST = schema?
GraphQL = schema!