-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from philsturgeon/feature/graphql-rest
GraphQL Talk and Ruby API Talk
- Loading branch information
Showing
4,683 changed files
with
496,365 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.12 MB
in-progress/a-no-nonsense-graphql-rest-comparison/img/crash-but-recover-2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.78 MB
in-progress/a-no-nonsense-graphql-rest-comparison/img/crash-but-recover.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.68 MB
in-progress/a-no-nonsense-graphql-rest-comparison/img/crash-unrecoverable.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+237 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/different-shapes-siezed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+170 KB
...ess/a-no-nonsense-graphql-rest-comparison/img/hypermedia-like-no-handlebars.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+221 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/old-isnt-boring.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+210 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/penny-farthing.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+254 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/random-bike-hacks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+117 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/random-bike-issues.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+731 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/random-bike-use-cases.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+98.4 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/random-bike.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+315 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/random-bikes-kinda-handy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+678 KB
...ss/a-no-nonsense-graphql-rest-comparison/img/random-bikes-obviously-misused.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+173 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/rest-can-do-that-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+280 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/rest-can-do-that-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+345 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/rest-can-do-that-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.67 MB
in-progress/a-no-nonsense-graphql-rest-comparison/img/rest-can-do-that-4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+167 KB
in-progress/a-no-nonsense-graphql-rest-comparison/img/rest-can-do-that-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
282 changes: 282 additions & 0 deletions
282
in-progress/a-no-nonsense-graphql-rest-comparison/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,282 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Title</title> | ||
<meta charset="utf-8"> | ||
<style> | ||
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); | ||
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); | ||
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); | ||
|
||
body { font-family: 'Droid Serif'; } | ||
h1, h2, h3 { | ||
font-family: 'Yanone Kaffeesatz'; | ||
font-weight: normal; | ||
} | ||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; } | ||
|
||
.remark-slide-content { background-size: contain; } | ||
|
||
.graphql-screenshot-light { background-color: #F5F6F8 } | ||
.graphql-screenshot-dark { background-color: #E6E8EC } | ||
</style> | ||
</head> | ||
<body> | ||
<textarea id="source"> | ||
|
||
class: center, middle | ||
|
||
# A No Nonsense GraphQL and REST Comparison | ||
|
||
### PHPNE 2017 / @philsturgeon | ||
--- | ||
background-image: url(img/different-shapes-siezed.jpg) | ||
--- | ||
background-image: url(img/penny-farthing.jpg) | ||
--- | ||
background-image: url(img/random-bike.jpg) | ||
--- | ||
background-image: url(img/random-bike-use-cases.jpg) | ||
--- | ||
background-image: url(img/random-bike-hacks.png) | ||
--- | ||
background-image: url(img/many-bikes.jpg) | ||
--- | ||
background-image: url(img/random-bike-issues.jpg) | ||
--- | ||
class: one-liner | ||
# Pro-GraphQL, Pro-REST, Pro-RPC | ||
--- | ||
class: one-liner | ||
## Anti-Nonsense | ||
|
||
??? | ||
I have recommended RPC, REST _and_ GraphQL for different services at WeWork in the last few months. | ||
|
||
--- | ||
# "GraphQL is REST 2.0" | ||
--- | ||
background-image: url(img/nonsense.jpg) | ||
# "GraphQL is REST 2.0" | ||
--- | ||
background-image: url(img/random-bikes-obviously-misused.jpg) | ||
--- | ||
|
||
GraphQL is a newer concept, being released by Facebook publicly in 2015. | ||
|
||
--- | ||
|
||
REST was a dissertation published by Roy Fielding in 2000, popularized kinda by companies like Twitter in 2006. | ||
|
||
--- | ||
|
||
This article uses the term REST as defined in Roy Fielding's dissertation, RESTish to mean it's somewhere on the Richardson Maturity Model but didn't make it to the top, and endpoint-based APIs to mean any REST/RESTish/RPC/etc. API that uses endpoints instead of POSTing to a single /graphql endpoint. | ||
|
||
A lot of people are over-hyping GraphQL for qualities that REST APIs have too, which is annoying. | ||
|
||
--- | ||
background-image: url(img/rest-can-do-that-1.png) | ||
class: graphql-screenshot-light | ||
--- | ||
# REST Allows That | ||
TODO slide about doing this in REST | ||
--- | ||
background-image: url(img/rest-can-do-that-2.png) | ||
class: graphql-screenshot-light | ||
--- | ||
# REST Allows That | ||
TODO slide about doing this in REST | ||
--- | ||
background-image: url(img/rest-can-do-that-3.png) | ||
class: graphql-screenshot-dark | ||
--- | ||
# REST Allows That | ||
TODO slide about doing this in REST | ||
--- | ||
background-image: url(img/rest-can-do-that-4.gif) | ||
class: graphql-screenshot-dark | ||
--- | ||
# REST Begs You To Do That! | ||
TODO slide about doing this in REST | ||
--- | ||
|
||
Many of these ideas were taken _from_ REST, which is awesome. | ||
|
||
Share ideas around, learn and benefit from all. | ||
|
||
--- | ||
|
||
Time Wasting | ||
|
||
Rebuilding stuff for one thing, which you could have in REST is wasteful | ||
|
||
--- | ||
|
||
Brain Washing | ||
|
||
Switching just becauase hype or cool is a drug you gotta quit | ||
|
||
--- | ||
|
||
1. REST and GraphQL are totally different | ||
|
||
2. GraphQL isn't a magic bullet, nor is it "better" | ||
|
||
3. You can definitely use both at the same time | ||
|
||
4. GraphQL is dope if used for the right thing | ||
|
||
--- | ||
|
||
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. | ||
|
||
--- | ||
|
||
## Remember FQL? | ||
|
||
``` | ||
GET /fql?q=SELECT%2Buid2%2BFROM%2Bfriend%2BWHERE%2Buid1%3Dme()&access_token=... | ||
``` | ||
|
||
Facebook didn't like FQL _and_ RESTish so they combined it | ||
|
||
??? | ||
Most of us would never even consider using FQL | ||
|
||
--- | ||
|
||
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. | ||
|
||
--- | ||
|
||
basic show off how graphql works | ||
|
||
--- | ||
|
||
background-image: url(img/richardson.png) | ||
|
||
# Richardson Maturity Model | ||
|
||
--- | ||
|
||
SLIDE WITH SHIT CIRCLED like without HATEOAS RESTISH | ||
|
||
--- | ||
|
||
background-image: url(img/hypermedia-like-no-handlebars.jpg) | ||
|
||
# REST /wo HATEOAS = RESTish | ||
|
||
--- | ||
|
||
Everyone thinks RESTish is REST | ||
|
||
--- | ||
|
||
Comparing RESTish to GraphQL is daft | ||
|
||
--- | ||
|
||
``` | ||
RESTish = (REST - HATEOAS + HTTP + (OData | (JSON Schema + JSON-API)) ) | ||
|
||
GraphQL == RESTish | ||
``` | ||
|
||
If your API is not using HATEOAS and you dont want to stitch together a bunch of best practices then GraphQL = A++ (Repeat later) | ||
|
||
--- | ||
|
||
Packaged together in one beautiful website | ||
|
||
Compare two websites... easy to see why one feels like a modern replacement for an old idea | ||
|
||
--- | ||
|
||
Basically GraphQL is a special type of RPC | ||
|
||
Mutations are very definitively RPC and the queries is like a default GET with params | ||
|
||
GraphQL encourages tight Coupling between client-server, making them quicker (dont need more requests) but fragile | ||
|
||
--- | ||
|
||
If your API is not using HATEOAS and you dont want to stitch together a bunch of best practices then GraphQL = A++ | ||
|
||
--- | ||
|
||
<blockquote class="twitter-tweet" data-conversation="none" data-lang="en"><p lang="en" dir="ltr">If you control both sides of the wire (client and server) and can deploy simultaneously, most of REST's constraints are unnecessary work.</p>— Darrel Miller (@darrel_miller) <a href="https://twitter.com/darrel_miller/status/894638898512621572">August 7, 2017</a></blockquote> | ||
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> | ||
|
||
--- | ||
|
||
Lose Coupling & Evolution | ||
|
||
<img src="img/crash-but-recover.gif"> | ||
|
||
--- | ||
|
||
Lose Coupling & Evolution | ||
|
||
<img src="img/crash-but-recover-2.gif"> | ||
|
||
--- | ||
|
||
Tight Coupling... | ||
|
||
<img src="img/crash-unrecoverable.gif"> | ||
|
||
??? | ||
Need a LOT of developers | ||
Amazing docs + automated testing | ||
|
||
--- | ||
|
||
RESTish & GraphQL are both about Tight Coupling | ||
|
||
--- | ||
|
||
HATEOAS intends to avoid tight coupling | ||
|
||
--- | ||
|
||
How to HATEOAS | ||
|
||
1. Just links (they figure it from Allows: GET, PATCH) | ||
2. add more meta data to OPTIONS so they figure from that | ||
3. add controlls in response to avoid figuring | ||
|
||
--- | ||
|
||
do a thing about caching and | ||
|
||
TODO | ||
|
||
XSD was a layer on top of XML to describe what your data was. More than just the datatypes XML lacked, but min, max, enums, etc | ||
|
||
WSDL added to that and showed how the XSD-laden reqs/responses interacted. | ||
|
||
|
||
|
||
XSD -> JSON Schema | ||
WSDL -> JSON HyperSchema or HAL/Siren/UBER | ||
|
||
XSD -> Types | ||
WSDL -> Types + Introspection | ||
|
||
|
||
|
||
|
||
|
||
</textarea> | ||
<script src="https://remarkjs.com/downloads/remark-latest.min.js"> | ||
</script> | ||
<script> | ||
var slideshow = remark.create(); | ||
</script> | ||
</body> | ||
</html> |
24 changes: 24 additions & 0 deletions
24
in-progress/a-no-nonsense-graphql-rest-comparison/js/terminal.language.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Language: terminal console | ||
Author: Josh Bode <[email protected]> | ||
*/ | ||
|
||
hljs.registerLanguage('terminal', function() { | ||
return { | ||
contains: [ | ||
{ | ||
className: 'string', | ||
begin: '^([\\w.]+)@([\\w.]+)' | ||
}, | ||
{ | ||
className: 'constant', | ||
begin: ' (.*) \\$ ' | ||
}, | ||
{ | ||
className: 'ansi', | ||
begin: '<span style\\="([^"]+)">', | ||
end: '<\\/span>' | ||
} | ||
] | ||
} | ||
}); |
Binary file added
BIN
+327 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/faraday-adapters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.22 MB
in-progress/what-rails-can-teach-php-about-building-apis/img/grumpy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+69 KB
...ss/what-rails-can-teach-php-about-building-apis/img/http-access-denied-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.2 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/intro-happy.jpg
Oops, something went wrong.
Binary file added
BIN
+627 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/intro-sad.jpg
Oops, something went wrong.
Binary file added
BIN
+51.9 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/intro-wtf.jpg
Oops, something went wrong.
Binary file added
BIN
+90.8 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/kahlan-poll.png
Oops, something went wrong.
Binary file added
BIN
+19.2 MB
in-progress/what-rails-can-teach-php-about-building-apis/img/khalan.gif
Oops, something went wrong.
Binary file added
BIN
+124 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/phpvcr-arg.png
Oops, something went wrong.
Binary file added
BIN
+37.9 KB
in-progress/what-rails-can-teach-php-about-building-apis/img/phpvcr-overview.png
Oops, something went wrong.
Oops, something went wrong.