Lets Talk about...

GraphQL

What is GraphQL?

What is GraphQL?

API?

Why don't use

REST

Whats wrong with REST?

All in one Query?

Why don't use

SQL

Whats wrong with SQL?

Why GraphQL?

Why GraphQL?

 

Crash Course

Server

Types

type Employment {
  firstName: String!
  lastName: String!
  worksAt: [Shift]!
}
type Employment {
  firstName: String!
  lastName: String!
  worksAt: [Shift]!
}
type Employment {
  firstName: String!
  lastName: String!
  worksAt: [Shift]!
}
type Employment {
  firstName: String!
  lastName: String!
  worksAt: [Shift]!
}
type Employment {
  firstName: String!
  lastName: String!
  worksAt: [Shift]!
}
type Employment {
  firstName: String!
  lastName: String!
  worksAt: [Shift]!
}

Scalars

Build in Scalars

Custom Scalars

Enums

Interface

Using Interface

Union

Arguments

Arguments

Schema

schema {
  query: Query
  mutation: Mutation
}
... scalars ...
... interfaces ...
... unions ...
... types ...
 
schema {
  query: Query
  mutation: Mutation
}

Query

Query

Query

Mutation

Input Type

Mutation

Client

Call Queries

Basic

{
  employment(id: 1) {
    firstName
  }
}

Result

{
  "employment": {
    "firstName": "Tamino"
  }
}

Named

query FetchEmployment {
  employment(id: 1) {
    firstName
  }
}

With Parameters

query FetchEmployment($id: Int!) {
  employment(id: $id) {
    firstName
  }
}

Query Call

gql`
  query FetchEmployment($id: Int!) {
    employment(id: $id) {
      firstName
    }
  }
`, {
  id: 1,
}

Call Mutations

Libraries

Apollo

What is Apollo?

Reactivity?

 

Thats it

Whats next?

Questions?