@@ -55,15 +55,20 @@ serving queries against that type schema.
5555First, build a GraphQL type schema which maps to your code base.
5656
5757``` js
58- var GraphQL = require (' graphql' );
59-
60- var schema = new GraphQL.GraphQLSchema ({
61- query: new GraphQL.GraphQLObjectType ({
58+ import {
59+ graphql ,
60+ GraphQLSchema ,
61+ GraphQLObjectType ,
62+ GraphQLString
63+ } from ' graphql' ;
64+
65+ var schema = new GraphQLSchema ({
66+ query: new GraphQLObjectType ({
6267 name: ' RootQueryType' ,
6368 fields: {
6469 hello: {
65- type: GraphQL . GraphQLString ,
66- resolve : function () { return ' world' ; }
70+ type: GraphQLString,
71+ resolve : () => { return ' world' ; }
6772 }
6873 }
6974 })
@@ -79,7 +84,7 @@ Then, serve the result of a query against that type schema.
7984``` js
8085var query = ' { hello }' ;
8186
82- GraphQL . graphql (schema, query).then (function (result ) {
87+ graphql (schema, query).then (function (result ) {
8388
8489 // Prints
8590 // {
@@ -97,7 +102,7 @@ it, reporting errors otherwise.
97102``` js
98103var query = ' { boyhowdy }' ;
99104
100- GraphQL . graphql (schema, query).then (function (result ) {
105+ graphql (schema, query).then (function (result ) {
101106
102107 // Prints
103108 // {
@@ -126,7 +131,8 @@ JavaScript can be produced by running:
126131npm run build
127132```
128133
129- Once ` npm run build ` has run, you may ` require() ` directly from node.
134+ Once ` npm run build ` has run, you may ` import ` or ` require() ` directly from
135+ node.
130136
131137After developing, the full test suite can be evaluated by running:
132138
0 commit comments