Skip to content

Instantly share code, notes, and snippets.

@lvidal1
Created June 8, 2017 06:38
Show Gist options
  • Save lvidal1/5f8b63d0495149f9409613cdb3d1e3c9 to your computer and use it in GitHub Desktop.
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
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