Created
June 8, 2017 06:38
-
-
Save lvidal1/5f8b63d0495149f9409613cdb3d1e3c9 to your computer and use it in GitHub Desktop.
Very "Hello-world" for graphql server - Credit Udemy:GraphQL for Absolute Beginners: The Newbie Guide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var {graphql, buildSchema} = require('graphql'); | |
var schema = buildSchema (` | |
type Query{ | |
hello : String | |
} | |
`); | |
var root = { | |
hello: () => { | |
return 'Hello World.'; | |
} | |
}; | |
graphql(schema, '{hello}', root).then((response)=> | |
console.log(response) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment