Introduction to
Graphql
David Novicki

WHY?!
Flexible
Dynamic
Modular

Foundations
- Queries
- Mutations
- Schemas and Types
- Resolvers
Queries
At it's simplest form, asking for fields on objects. Think of queries as refined GET methods

Queries
This includes nested objects or arrays as well as the ability to chain multiple queries in parallel

Queries
And further more, we can add arguments to our queries

Queries
Just like most query languages, we are able to add inline logic to our query through GraphQL directives and variables

Mutations
Think as mutations as the POST of GraphQL

Mutations
Mutations allow the ability to run queries upon completion so you can execute POST then GET functionality in a single request

Mutations
Multiple mutations will always run in series rather than parallel as to avoid side-effects

Schemas and Type System
Schemas are the glue/mapping for our query language to business logic


Schemas and Type System
They define a general outline of abilities and provide a validation layer to all incoming queries and mutations

Resolvers
The foundation for queries and mutations to all your custom business logic. All queries and mutations must have a corresponding resolvers

REST VS GRAPHQL
REST
Pros:
- Widely adopted
- Standardized
Cons:
- Verbose
- Rigid
- Redundant
GRAPHQL
Pros:
- Flexible
- Efficient
- Standardized foundations
Cons:
- New kid on the block
- Learning curve
Example
GET: /authors/:id
GET: /authors/:id/posts
GET: /authors/:id/posts/:id/

GraphQL
REST
Example
Returns all data resulting in large response sizes

GraphQL
REST
Incremental adoption
Features

Remote Stitching
Features

Authentication
and
Authorization
Features

The End
Continuing Resources
- graphql.github.io
- medium.com/@novicki_david
- github.com/chentsulin/awesome-graphql
Graphql
By David Novicki
Graphql
An introduction to GraphQL
- 225