const { graphql } = require('graphql');
const { makeExecutableSchema } = require('graphql-tools');
const typeDefs = `
type Person {
name: String!
}
extend type Person {
salary: Int
}
type Query {
person: Person
}
`;
const resolvers = {
Query: {
person: () => ({ name: "John Doe", salary: 1234 })
}
}
const schema = makeExecutableSchema({ typeDefs, resolvers });
graphql(schema, '{ person {name salary} }').then((response) => {
console.log(response);
});