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, `
{
__schema {
types {
kind
name
fields {
name
type
}
}
}
}
`).then(console.log);