Due to the fact that someone hates me and reduces this question, I want to make sure that I understand how GraphQL works. Here's my understanding of one of the ways GraphQL is superior to the RESTful API. Let's say you have a model user:
{
user: {
firstName: "John",
lasName: "Smith",
username: "jsmith",
email: "jsmith@company.com",
gender: "M",
password: "password"
}
}
Then you call the API of getthis user information for your application’s profile page. Suppose you only need a user firstName(perhaps to display a welcome message).
axios.get(get_user_info_url).then(res => {
const firstName = res.data.user.firstName
})
, , , res , , (, username email). , . firstName . , user ( ) , , , .
, , res.data.user.firstName. GraphQL firstName, . , GraphQL (overfetching).
, , (, firstName). , , / .
GraphQL?