Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Myths #2

Open
philsturgeon opened this issue Nov 4, 2019 · 0 comments
Open

Myths #2

philsturgeon opened this issue Nov 4, 2019 · 0 comments

Comments

@philsturgeon
Copy link

philsturgeon commented Nov 4, 2019

REST is about CRUD

REST is no more about CRUD than any other paradigm is. RPC and Query Languages can be used for CRUD or use-case driven APIs, and researching use cases will produce an API more appropriate for the users who use cases you gathered. APIs are about balancing use cases with reusability, and not about overly normalizing your data to the point where its just a JSON version of your DB. https://medium.com/@__xuorig__/the-tension-between-data-use-case-driven-graphql-apis-8f982198653b

REST is tied to HTTP/1

Some folks who use gRPC think you need to use gRPC to get the benefits of HTTP/2?

  • REST can operate over HTTP/1.1, HTTP/2, or HTTP/3 if you like. HTTP/2 server push handles multiplexing just like gRPC, and HTTP/2 Server Push is also the basis for GraphQL/Apollo's @defer keyword

REST means huge responses

REST cannot handle real-time

  • Webhooks exist in most REST APIs to push our updates to other servers

  • GraphQL Subscriptions are generally implemented over Web Sockets, and nothing about building a REST API says you cannot use Web Sockets. Go wild.

REST does not have a type system

"Stateless" means...

REST is "stateless" in that sessions should not be sticky between servers, which helps ensure load balancers can do their job without things folks needing to log in and log out. Each message should contain the means to authenticate the user, such as HTTP Digest, OAuth credentials, Bearer token, JWT, etc.

REST is however for designing state machines. https://apisyouwonthate.com/blog/representing-state-in-rest-and-graphql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant