React Express

2.1ES2015...
2.3JSX
6.2Redux...
6.3GraphQL...
The GraphQL Schema
The GraphQL Schema
In this section, we'll discuss the backbone of every GraphQL server: The GraphQL Schema.
For a technical deep dive all around the GraphQL schema, be sure to check out this article.
The Schema Definition Language (SDL)
GraphQL has a type system that’s used to define the capabilities of an API. These capabilities are written down in the GraphQL schema using the syntax of the GraphQL Schema Definition Language (SDL). Here’s what the Post type from our previous examples looks like:
type Post {
  id: ID!
  description: String!
  imageUrl: String!
}
The syntax is pretty straightforward. We’re defining a type called Post that has three properties, in GraphQL terminology these properties are called fields. Each field has a name and a type. The exclamation point following a type means that this field cannot be null.
Schema Root Types
Each schema has so-called root types that define the entry points into the API. These are the root types that you can define in your schema:
  • Query: Specifies all the queries a GraphQL server accepts
  • Mutation: Specifies all the mutations a GraphQL server accepts
  • Subscription: Specifies all the subscriptions a GraphQL server accepts (subscriptions are used for realtime functionality, learn more here)
To enable the feed query and createPost mutation that we saw in the previous examples, you’d have to write the root types as follows:
type Query {
  feed: [Post!]!
}

type Mutation {
  createPost(description: String!, imageUrl: String!): Post
}
You can read more about the core GraphQL constructs here.