Skip to content

Commit

Permalink
Proposition to change README examples to ES2015 style due to GraphQL …
Browse files Browse the repository at this point in the history
…is also written in ES2015.
  • Loading branch information
enaqx committed Jul 2, 2015
1 parent a033219 commit 07382b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ JavaScript can be produced by running:
npm run build
```

Once `npm run build` has run, you may `require()` directly from node.
Once `npm run build` has run, you may `import` or `require()` directly from
node.

The full test suite can be evaluated by running:

Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,20 @@ serving queries against that type schema.
First, build a GraphQL type schema which maps to your code base.

```js
var GraphQL = require('graphql');

var schema = new GraphQL.GraphQLSchema({
query: new GraphQL.GraphQLObjectType({
import {
graphql,
GraphQLSchema,
GraphQLObjectType,
GraphQLString
} from 'graphql';

var schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'RootQueryType',
fields: {
hello: {
type: GraphQL.GraphQLString,
resolve: function() { return 'world'; }
type: GraphQLString,
resolve: () => { return 'world'; }
}
}
})
Expand All @@ -79,7 +84,7 @@ Then, serve the result of a query against that type schema.
```js
var query = '{ hello }';

GraphQL.graphql(schema, query).then(function (result) {
graphql(schema, query).then(function (result) {

// Prints
// {
Expand All @@ -97,7 +102,7 @@ it, reporting errors otherwise.
```js
var query = '{ boyhowdy }';

GraphQL.graphql(schema, query).then(function (result) {
graphql(schema, query).then(function (result) {

// Prints
// {
Expand Down Expand Up @@ -126,7 +131,8 @@ JavaScript can be produced by running:
npm run build
```

Once `npm run build` has run, you may `require()` directly from node.
Once `npm run build` has run, you may `import` or `require()` directly from
node.

After developing, the full test suite can be evaluated by running:

Expand Down

0 comments on commit 07382b8

Please sign in to comment.