EdgeCoders
Published in

EdgeCoders

GraphQL Deep Dive: The Cost of Flexibility

GraphQL logo

GraphQL Queries

Here’s an example of a GraphQL query that a client can use to ask a server about the name and email of user #42:

{
user(id: 42) {
name,
email
}
}
{
"data": {
"user": {
"name": "John Doe",
"email": "john@example.com"
}
}
}

GraphQL Mutations

Reading is just one of the four CRUD operations that a client can communicate to a server. Most clients will also communicate their need to update the data. In GraphQL, this can be done with Mutations.

mutation {
addComment(
postId: 42,
authorEmail: "mark@fb.com",
markdown: "GraphQL is clearly a **game changer***"
) {
id,
formattedBody,
timestamp
}
}

Problems and Concerns

Perfect solutions are fairy tales. With the flexibility GraphQL introduces, a door opens on some clear problems and concerns.

Unlisted

--

--

jsComplete’s Medium Publication — jsComplete is a FREE software educational library focused on JavaScript, Node, React & GraphQL. It has video courses, books, articles, and interactive lessons.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Samer Buna

Samer Buna

Author for Pluralsight, O'Reilly, Manning, and LinkedIn Learning. Curator of jsComplete.com