Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
stop68023yFrom what i know graphql is like saying what i want and getting it. An usual rest api is providing an document which promises which content is accessible where.
-
hitko31453yActually Facebook, Braintree / PayPal, GitHub, and several other big ones already use GraphQL and recommend it over REST APIs. Microsoft Graph API also uses GraphQL-style requests where the API only returns the requested fields. I'd recommend using REST only if you need to quickly fetch one or two flat documents (i.e. without relationships), and nothing else
-
cheesy23yI'm working with GrapqhQl for almost a year now and I enjoy it. It takes a while until you wrap you head around it. But FieldResolver, Interfaces and Unions makes it really easy to extend existing endpoints without breaking backwards compatibility. It does not magically solve every problem you have with REST. And I feel you need a certain size of an API to justify the overhead.
-
As with almost everything, it depends.
GraphQL is very nice when you want to avoid the hassle of having many REST endpoints to fetch data with multiple requests and then put it all together with some joined ids like from a relational databse.
REST also tends to become hard to document, even with swagger. With GraphQL, the definition of the data is the formal documentation at the same time.
And GraphQL gives you the flexibility to query only the data that you want. Which of course is only good if you actually need the flexibility. But sometimes it’s overkill and REST is simpler. -
hitko31453y@Devnergy There's no need for something like Swagger with GraphQL. A GraphQL API server knows all data types, input types, relationships, and operations it supports, therefore you can just run an introspection query to get all information about the API in real time (a.k.a. GraphQL schema).
When starting a new project, is it still best to use Rest API than GraphQL?
Most big enterprise companies use Rest API.
question