3 ms·
Your understanding matches my understanding, but you missed the point which was the "ah ha!" moment for me. Which is that the front end developer can design the
by AndrewOMartin 7y ago
Your understanding matches my understanding, but you missed the point which was the "ah ha!" moment for me. Which is that the front end developer can design their own endpoints without bothering the back end developer.
When a front end developer wants to request a specific shape of data (e.g. All the people with age between x and y who are within a distance of z of the logged in user and just get their name and list of interests) then with REST they have to either compose that data from the available endpoints or bother a back end developer for a new endpoint.
With GraphQL the front end developer can compose the query themselves without knowledge of any back end technology beyond the GraphQL schema.
E.g. they'd write something like the following, using either a schema reference, or introspection-powered autocomplete UI to find out which fields are valid.
query nearbyCandidates {
allUsers(filters{
isTheLoggedInUser:false,
ageBetween:{start:x, end:y},
closerThan:{distance: z, from: [LoggedInUserPosition]},
}){
interests:{
interestName:name,
description,
}
candidateName:name,
}
}
This actual story is a bit of a fairy tale because you'd still need the two developers to interact if the required fields or filters did not exist.
Finally the general theme of the comments here, that there's nothing stopping you using both, is accurate.
- pier25 7y agoUnless you are using something like Hasura which in many cases negates the need of a backend developer. Front end developers can have almost total autonomy.