July 2019
Intermediate to advanced
416 pages
10h 6m
English
With our database code in place, we are now ready to turn our attention to writing our GraphQL server. One of the earliest decisions I took when writing the sample code for this chapter was that we would simplify the process of writing our code as much as possible. If we look at a reference sample that Facebook posted, we will find that the code can be tediously long-winded:
import { graphql, GraphQLSchema, GraphQLObjectType, GraphQLString} from 'graphql';var schema = new GraphQLSchema({ query: new GraphQLObjectType({ name: 'RootQueryType', fields: { hello: { type: GraphQLString, resolve() { return 'world'; } } } })});
This example is from https://github.com/graphql/graphql-js. We can see that we have a lot of ...
Read now
Unlock full access