Skip to content

Instantly share code, notes, and snippets.

@mannharleen
Created March 9, 2020 11:02
Show Gist options
  • Save mannharleen/f2aefa462cc3815b534f2afb89ee2221 to your computer and use it in GitHub Desktop.
Save mannharleen/f2aefa462cc3815b534f2afb89ee2221 to your computer and use it in GitHub Desktop.
const { graphql, buildSchema } = require("graphql")
let schema = buildSchema(`
type Query {
hello: Book
}
type Book {
id: ID!
name: String!
}
`)
let resolver = {
//Query: {
hello: () => {
return {id: "1", name: "book1"}
},
Book : () => {
name: () => "bookxxxxx"
}
//}
}
graphql(schema, '{hello {id, name}}', resolver).then(res => console.log(res))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment