Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

GraphQL Intro

배준일(Bae Junil) edited this page Aug 10, 2021 · 2 revisions

[issue]원활한 소통을 위해 한글로 부탁드립니다.

What is GraphQL?

It's a query language and a runtime server-side application that creates an API that enables fast and flexible API call.

An advantage it has over REST APIs is that they allow client-side requests to be specified to allow only the requested data to be handed over. And assuming I know all the rules in the book, its quite easy to use and implement.

이름이 왜 GraphQL인가? 궁금하면 읽어봐 아래에 노드와 엣지에 대한 이유도 여기서 나와

Terminology used in GraphQL

Relay(GraphQL Relay Specifications)

GraphQL uses Relay, a Javascript framework for fetching and managing GraphQL data.

  • Mechanism for fetching an object
  • Provides description of how to page through connections
  • Its a structure around mutations to make them predictable

Connections(GraphQL Cursor Connections Specifications)

Basically, its a cursor-based pagination model.

Cursor-based pagination is the most efficient method of paging and should always be used where possible

pageInfo

  • Contains information about set of edges defined by the client arguments
    • hasPreviousPage and hasNextPage
      • Boolean indicator of whether more edges exist within the page provided by the clients arguments
    • startCursor and `endCursor
      • Cursors corresponding to the first and last nodes in edges, respectively

edge

  • Array of records(data)
  • Contains a node and a cursor
    • Node
      • Your data or a record
    • Cursor
      • String to help relay with pagination

Reference

Relay

Connection

GraphQL connections

Facebook Graph API Doc