Menu

React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

REST vs GraphQL

Many developers are pondering on the differences between GraphQL standard and REST APIs. They are both similar in functionality as interfaces that expose system Application Programming Interfaces (API) via the HTTP (Hyper Text Transfer Protocol). There are some essential differences, though.

REST is an architectural style that has been around since the early 2000's. It focuses on using the HTTP verbs (GET, POST, PATCH...) to control a remote resource. However there is no standard definition of what exactly a REST API is. This is why it's better to discuss about them as RESTful interfaces, since they conform to the basic REST functionalities.

There are additional protocols built on top of the REST like Hydra, but there is a completely separate architecture and protocol. GraphQL on the other hand is a separate technology from REST. Instead of using the HTTP verbs, the system focuses on GET queries that contains queries (for reads) and mutations (for writes). In addition there are some interesting features to GraphQL, such as introspection that gives developers insight into what the interface offers.

Both GraphQL and REST have client libraries available to abstract the underlying HTTP communications. The most advanced GraphQL library is Apollo, which comes from the Meteor team and offers support for both Angular 2 and React. For REST, one of the more advanced clients is Hyjax, which is a Hydra Core aware API client written in JavaScript.

Learn more about REST and GraphQL:

Written by Jorgé on Saturday September 24, 2016

Permalink -

« Installing WordPress on Windows Subsystem for Linux (WSL/Ubuntu) - Free TypeScript book download as PDF, MOBI, EPUB »