Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimal null prototype reproduction
// @ts-check
const { graphql } = require('graphql');
const { makeExecutableSchema } = require('graphql-tools');
const schema = makeExecutableSchema({
typeDefs: `
type Query {
get(input: Input!): String!
}
type Mutation {
create(input: Input!): String!
}
input Input {
id: String!
}
`,
resolvers: {
Query: {
get(_, args) {
console.log(args.input);
return 'Blah';
}
},
Mutation: {
create(_, args) {
console.log(args.input);
return 'Blah';
}
}
}
});
graphql({
schema,
source: 'mutation { create(input: { id:"123" })}'
}).then(result => {
console.log(result);
});
graphql({
schema,
source: 'query { get(input: { id:"123" })}'
}).then(result => {
console.log(result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.