GraphQL Fantasy API
- What is GraphQL?
- GraphQL vs. REST
- GraphQL server and client
- Important Concepts and Terminology
- Schema
- Resolvers
- Types
- Queries
- Mutations
Tutorial walkthrough.
- Server
- Create a simple back end (Node/Express) that returns a single
/graphql
endpoint - Using "in memory" data store to avoid overhead of databases
- Using Node 16/module type to avoid overhead of webpack
- Create a simple back end (Node/Express) that returns a single
- Client
- Create a simple front end (vanilla JS? React?) that queries the
/graphql
endpoint
- Create a simple front end (vanilla JS? React?) that queries the
- GraphiQL -Using GraphiQL for local development testing
Using Fantasy/RPG data for example schema. Build it into the graphQL server above.
- Type System
- GraphQL Object Type (
type
, fields (properties)) - Scalar Type (aka primitives,
String
,Int
,Boolean
,Float
) - Enumeration (
enum
) - Interface/Union Type (
interface
,|
(union)) - Type Modifiers (
!
(non-nullable) and[]
(list)) - Entrypoint (Operation) Types (
Query
andMutation
) - Comments/description (
""
)
- GraphQL Object Type (
- Queries (read)
- Simple query (no name)
- Operation names (
query
) - Aliases
- Arguments
- hard-coded
- query parameter
- directives
- Fragments (
fragment
and...
)
- Mutations (write)
- Input Types (
input
)
- Input Types (
- Resolvers
- Resolver functions
resolveType
- Context
- Pagination: Connections Pattern - Edges and Nodes
- Introspection (
__schema
,__type
,name
,kind
,ofType
)