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

REST API vs. GraphQL: Comparison is not fair #99

Open
stationname opened this issue Sep 10, 2024 · 3 comments
Open

REST API vs. GraphQL: Comparison is not fair #99

stationname opened this issue Sep 10, 2024 · 3 comments

Comments

@stationname
Copy link

To doc compares that GraphQL has only one endpoint while REST API has many. It also states that in GraphQL you can select exactly what items from the database you'd like to have.

However, you can write you REST API the exactly same way: Put everything in one endpoint and let the requestee decide on which items they'd like to receive.
Now you might think that "well, then you need to implement all that logic inside the REST API endpoint.", but this is exactly what you need to do for GraphQL.

If this is a trap in order to find out which of the beginners actually paid attention, then I have nothing to complain. In any other case I think the comparison is not fair.

@jits
Copy link

jits commented Sep 10, 2024

However, you can write you REST API the exactly same way: Put everything in one endpoint and let the requestee decide on which items they'd like to receive.

Then it stops becoming a REST(ful) design according to the original definition of REST — it's just a custom API design built on top of HTTP.

@stationname
Copy link
Author

stationname commented Sep 10, 2024

I see, we're talking on two different slates, I guess.

[Clarification]
I thought the content was purely technical / functional. As I understand your response, the content is rather philosophical.

[Suggestion]
I think it would be very helpful to point that out on the page.

[Background]
I've had various encounters with people speechless after they realized that technically both approaches can do the same and "using one endpoint for all requests" is no pro for GraphQL. As of my experience most inexperienced people cannot grasp that already.

@jits
Copy link

jits commented Sep 10, 2024

@stationname

I wouldn't say this is philosophicalREST, as a term, has quite a specific meaning and conceptual model when it comes to API design.

Agreed that the content should probably provide more clarification (I haven't looked at it in detail, so can't comment specifically).

(Note: I'm not associated with this project)

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

2 participants