Created
May 10, 2018 16:57
-
-
Save gc-codesnippets/f0e58b0e34cd57c7bac1f1e53adc50b7 to your computer and use it in GitHub Desktop.
This file contains 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 { Binding } = require('graphql-binding') | |
const { makeExecutableSchema } = require('graphql-tools') | |
class HelloBinding extends Binding { | |
constructor() { | |
const typeDefs = ` | |
type Query { | |
hello(name: String): String | |
} | |
` | |
const resolvers = { | |
Query: { | |
hello: (_, args) => `Hello ${args.name || 'World'}!`, | |
}, | |
} | |
super({ | |
schema: makeExecutableSchema({ typeDefs, resolvers }) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment