We moved to new place!!
I’ve started learning GraphQL and decided to share some information that I find useful.
GraphQL is a query language to retrieve data from the server.
Unlike REST queries, GraphQL is “smart”. Main benefit is that, instead of many REST nodes, we only have one smart node, that can provide us with the exact information we need.
Basic GraphQL queries
People commonly call everything that hits your GraphQL API server a “query”. But there are a lot of things mixed in there. What do we call a unit of work we’re asking the server to do? It could be a query, a mutation, or a subscription.
- Selection set: A set of fields requested in an operation, or nested within another field. A GraphQL query must contain a selection set on any field that returns an object type, and selection sets are not allowed on fields that return scalar types, such as
[String!] vs [String]!
This means that the list itself can be null, but it can’t have any null members. For example, in JSON:
myField: null // valid myField:  // valid myField: ['a', 'b'] // valid myField: ['a', null, 'b'] // error
Now, let’s say we defined a Non-Null List of Strings:
This means that the list itself cannot be null, but it can contain null values:
myField: null // error myField:  // valid myField: ['a', 'b'] // valid myField: ['a', null, 'b'] // valid Source: http://graphql.org/learn/schema/