Skip to content

Instantly share code, notes, and snippets.

@gc-codesnippets
Created May 10, 2018 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gc-codesnippets/f0e58b0e34cd57c7bac1f1e53adc50b7 to your computer and use it in GitHub Desktop.
Save gc-codesnippets/f0e58b0e34cd57c7bac1f1e53adc50b7 to your computer and use it in GitHub Desktop.
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