Created
March 9, 2020 11:02
-
-
Save mannharleen/f2aefa462cc3815b534f2afb89ee2221 to your computer and use it in GitHub Desktop.
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
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