-
GraphQLModeling/Architecture 2020. 3. 8. 14:41
1. Overview
GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. It allows clients to define the structure of the data required, and the same structure of the data is returned from the server, therefore preventing excessively large amounts of data from being returned, but this has implications for how effective web caching of query results can be. The flexibility and richness of the query language also add complexity that may not be worthwhile for simple APIs. It consists of a type system, query language and execution semantics, static validation, and type introspection.
GraphQL supports reading, writing (mutating), and subscribing to changes to data (realtime updates - most commonly implemented using WebHooks).
GraphQL servers are available for multiple languages, including Haskell, JavaScript, Perl, Python, Ruby, Java, C#, Scala, Go, Elixir, Erlang, PHP, R, and Clojure.
On 9 February 2018, the GraphQL Schema Definition Language (SDL) became part of the specification.
2. Description
2.1 Motivation
GraphQL helps to address some of the more common headaches developers faced when building a REST API - backend application.
2.1.1 Multiple round trips
You have a singleton REST resource that is too tightly coupled to your client UI. A new requirement comes from your product designer with changes. Newer clients would be requesting data that they essentially don't need anymore. Not that bat when you just start out, but in the long run, it'll be something nagging at you.
2.1.2 Overfetching of data
Wouldn't it be nice if their client receives only the data that ie requires and had requested?
2.1.3 Documenting your API now becomes a thing.
More than just writing down the specs in a formal form so that it can be referenced. How you allow one to discover and explore your API?
2.2 What is GraphQL
A GraphQL query is a string interpreted by a server that returns data in a specified format.
3. Reference
tech.kakao.com/2019/08/01/graphql-basic/
https://medium.com/@FourwingsY/graphql%EC%9D%84-%EC%98%A4%ED%95%B4%ED%95%98%EB%8B%A4-3216f404134
'Modeling > Architecture' 카테고리의 다른 글
Command Query Responsibility Segregation (CQRS) (0) 2020.03.10 Representational state transfer (REST) API (0) 2020.03.08 Resource Sharing, Critical Sections, and Atomic operations (0) 2020.02.27 Stack and Heap Memory Regions (0) 2020.02.26 Relationship of Thread, Process, OS, and Memory (0) 2020.02.04