GraphQL vs REST: обзор

Phil Sturgeon, “GraphQL vs REST: Overview”, public translation into English from English More about this translation.

Translate into another language.

Participants

Big_Shark 82 points
atygaev.mi 16 points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8 9 10

GraphQL vs REST: Overview

GraphQL vs REST: обзор

History of edits (Latest: Big_Shark 3 months, 2 weeks ago) §

A few months back I wrote a comparison between RPC and REST for Smashing Magazine, and now I want to talk about the differences between REST and GraphQL: the new kid on the block.

Несколько месяцев назад я написал сравнение между RPC и REST для Smashing Magazine, и теперь я хочу поговорить о различиях между REST и GraphQL: Новичком на этом поприще.

History of edits (Latest: Big_Shark 3 months, 2 weeks ago) §

GraphQL is incorrectly considered by some to be a "replacement" to REST. GraphQL is a newer concept, being released by Facebook publicly in 2015, whereas REST was a dissertation published by Roy Fielding in 2000, popularized by companies like Twitter (quite inaccurately) in 2006.

Некорректно считается, что GraphQL является «заменой» REST. GraphQL - это просто более новый концепт, который опубликовал Facebook в 2015 году, тогда как REST была опубликованной Роем Филдингом в 2000 году, и получил популярность от только в 2006 году, благодаря Twitter.

History of edits (Latest: Big_Shark 3 months, 2 weeks ago) §

This article aims to cover a few notable differences, and make the following points:

Эта статья призвана охватить несколько различий и сделать следующие замечания:

History of edits (Latest: Big_Shark 3 months, 2 weeks ago) §

REST and GraphQL are totally different

REST и GraphQL абсолютно разные.

History of edits (Latest: atygaev.mi 1 month, 3 weeks ago) §

GraphQL isn't a magic bullet, nor is it "better"

GraphQL это не серебрянная пуля и уж точно не замена REST.

History of edits (Latest: atygaev.mi 1 month, 3 weeks ago) §

You can definitely use both at the same time

GraphQL is dope if used for the right thing

A few quick differences

REST is an architectural concept for network-based software, has no official set of tools, has no specification, doesn't care if you use HTTP, AMQP, etc., and is designed to decouple an API from the client. The focus is on making APIs last for decades, instead of optimizing for performance.

GraphQL is a query language, specification, and collection of tools, designed to operate over a single endpoint via HTTP, optimizing for performance and flexibility.

One of the main tenants of REST is to utilize the uniform interface of the protocols it exists in. When utilizing HTTP, REST can leverage HTTP content-types, caching, status codes, etc., whereas GraphQL invents its own conventions.

Another main focus for REST is hypermedia controls (a.k.a HATEOAS), which lets a well designed client run around an API like a human runs around the Internet; starting with a search for "How to complete my tax returns", reading a perfectly relevant article, and after a few clicks ending up on BuzzFeed article about Miley Cyrus throwing Liam Hemsworth a "Weed-Themed" birthday party.

If your API is not using hypermedia controls, then GraphQL could be a more relevant approach, because you weren't really using REST anyway.

This article will not attempt to point out a winner, but we're going to look at a few areas where the two differ. Don't get mad that a lot of the sections say "it depends", because the winner in each section really depends on what your API is doing, and how. GraphQL comes out stronger in some areas, REST in others, and sometimes they're both kinda terrible. Let's dig in!

Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8 9 10