/plushcap/analysis/hasura/rest-view-of-graphql

A REST View of GraphQL

What's this blog post about?

The article discusses the comparison between REST and GraphQL, two different approaches to data querying and updating. It explains that while both have their merits, they are not directly comparable as they serve different purposes. REST is an architectural style for designing distributed systems, whereas GraphQL is a language specification for defining, querying, and updating data. The article delves into the details of REST, including its constraints such as client-server pattern, statelessness, cacheability, uniform interface, unique resource identification, representation manipulation, self-descriptiveness, hypermedia as the engine of application state (HATEOAS), layered system, and code on demand. It also discusses how REST is implemented in practice and highlights that while some constraints are baked into HTTP, others need to be explicitly followed. The article then introduces GraphQL, a language developed by Facebook for defining data schemas, queries, and updates. It explains the advantages of using GraphQL, such as allowing clients to fetch only the exact data they need, enabling frontend teams to execute faster with less dependency on backend teams, and generating type-safe clients. However, it also notes that implementing resolvers in GraphQL can be challenging. The article concludes by stating that "GraphQL vs REST" is not a valid comparison as both serve different purposes. It suggests that architects should understand the requirements of their systems and choose technology accordingly to meet those requirements effectively.

Company
Hasura

Date published
July 7, 2020

Author(s)
Gautam BT

Word count
2975

Language
English

Hacker News points
121


By Matt Makai. 2021-2024.