2. Summary
➔ Yet another f****** javascript framework ?
➔ Sounds great but REST already does it !
➔ Does it also cook ?
➔ Let’s cook !
➔ Questions ?
3. 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)
4. 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
5. 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
6. 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"}
7. 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
8. 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
10. Scrambled eggs tasted good but nothing more ?
➔ We have just scratched the surface !
◆ mutation
◆ directive
◆ introspection
◆ validation
◆ operations
◆ etc...