GraphQL
Unleash your backend
Summary
➔ Yet another f****** javascript framework ?
➔ Sounds great but REST already does it !
➔ Does it also cook ?
➔ Let’s cook !
➔ Questions ?
Yet another f*****g javascript framework ?
➔ NOT a framework, a Facebook SPECIFICATION !
➔ Define a query langage to query and fetch data from any backends in a declarative way
➔ At october 2015, still in draft...
➔ No roadmap known : it will be done when its done ! (Blizzard way)
WTF, is it just a rough draft ?
➔ Used in production by iOS and Android native Facebook apps since 2012
➔ Open sourced
➔ Redesigned to fit to a wide range of backends
➔ Reference implementation in JS : https://github.com/graphql/graphql-js
Give me the keys !
➔ Keys concepts of the GraphQL query language
◆ Hierarchical : a GraphQL query is a hierarchical set of fields
◆ Product-centric : the front drives the back ( finally !!! )
◆ Strong-typing : GraphQL queries are syntactically checked and provided data are type safe
◆ Client-specified queries : return exactly what the client is asking for, no more !
◆ Intropesctive : clients and tools can query the type system using the GraphQL syntax itself
◆ Application-layer Protocol : you can use FTP if you want
And if finally starting up ?
➔ Like JSON objects without properties
➔ Http the more common way to query (GET or POST)
➔ Not just read data, but create / update / delete via mutation
// a json object
{
"user": {
"name" : "myName"
}
}
// a graphql query
{
user {
name
}
}
// seems familiar ?
/graphql?query=query+getUser($id:ID){user(id:$id){name}}&variables={"id":"4"}
Sounds great but REST already does it !
➔ “Sure ! Ofcourse, we have a RESTful API”
“You mean ad hoc REST inspired endpoints”
“Absolutely, a REST adhoc ful endpoints architecture !”
“...”
➔ RESTful API is server centric : you deliver all kind of data no matter what the front realy
needs
➔ New needs often means new endpoints
Does it also cook ?
➔ NO !!!! it doesn’t cook for you
➔ Cache, cache everywhere !!!
◆ Proxy (HTTP GET/POST)
◆ Client
◆ Server (Node / Database)
➔ “You must unlearn what you have learned” Yoda
◆ Must work with front needs first
◆ Create custom data type
➔ Realized the GraphQL pattern is not trivial
Let’s cook !
https://ide.c9.io/telligcirdec/graphql
Scrambled eggs tasted good but nothing more ?
➔ We have just scratched the surface !
◆ mutation
◆ directive
◆ introspection
◆ validation
◆ operations
◆ etc...
Questions ?
?
Links
● https://github.com/facebook/graphql
● http://facebook.github.io/graphql
● https://github.com/graphql/graphql-js
● https://blog.risingstack.com/graphql-overview-getting-started-with-graphql-and-nodejs/
● https://facebook.github.io/react/blog/2015/05/01/graphql-introduction.html
● https://github.com/Netflix/falcor

GraphQL

  • 1.
  • 2.
    Summary ➔ Yet anotherf****** javascript framework ? ➔ Sounds great but REST already does it ! ➔ Does it also cook ? ➔ Let’s cook ! ➔ Questions ?
  • 3.
    Yet another f*****gjavascript framework ? ➔ NOT a framework, a Facebook SPECIFICATION ! ➔ Define a query langage to query and fetch data from any backends in a declarative way ➔ At october 2015, still in draft... ➔ No roadmap known : it will be done when its done ! (Blizzard way)
  • 4.
    WTF, is itjust a rough draft ? ➔ Used in production by iOS and Android native Facebook apps since 2012 ➔ Open sourced ➔ Redesigned to fit to a wide range of backends ➔ Reference implementation in JS : https://github.com/graphql/graphql-js
  • 5.
    Give me thekeys ! ➔ Keys concepts of the GraphQL query language ◆ Hierarchical : a GraphQL query is a hierarchical set of fields ◆ Product-centric : the front drives the back ( finally !!! ) ◆ Strong-typing : GraphQL queries are syntactically checked and provided data are type safe ◆ Client-specified queries : return exactly what the client is asking for, no more ! ◆ Intropesctive : clients and tools can query the type system using the GraphQL syntax itself ◆ Application-layer Protocol : you can use FTP if you want
  • 6.
    And if finallystarting up ? ➔ Like JSON objects without properties ➔ Http the more common way to query (GET or POST) ➔ Not just read data, but create / update / delete via mutation // a json object { "user": { "name" : "myName" } } // a graphql query { user { name } } // seems familiar ? /graphql?query=query+getUser($id:ID){user(id:$id){name}}&variables={"id":"4"}
  • 7.
    Sounds great butREST already does it ! ➔ “Sure ! Ofcourse, we have a RESTful API” “You mean ad hoc REST inspired endpoints” “Absolutely, a REST adhoc ful endpoints architecture !” “...” ➔ RESTful API is server centric : you deliver all kind of data no matter what the front realy needs ➔ New needs often means new endpoints
  • 8.
    Does it alsocook ? ➔ NO !!!! it doesn’t cook for you ➔ Cache, cache everywhere !!! ◆ Proxy (HTTP GET/POST) ◆ Client ◆ Server (Node / Database) ➔ “You must unlearn what you have learned” Yoda ◆ Must work with front needs first ◆ Create custom data type ➔ Realized the GraphQL pattern is not trivial
  • 9.
  • 10.
    Scrambled eggs tastedgood but nothing more ? ➔ We have just scratched the surface ! ◆ mutation ◆ directive ◆ introspection ◆ validation ◆ operations ◆ etc...
  • 11.
  • 12.
    Links ● https://github.com/facebook/graphql ● http://facebook.github.io/graphql ●https://github.com/graphql/graphql-js ● https://blog.risingstack.com/graphql-overview-getting-started-with-graphql-and-nodejs/ ● https://facebook.github.io/react/blog/2015/05/01/graphql-introduction.html ● https://github.com/Netflix/falcor