graphql-tools extend

node v10.24.1
version: 1.0.0
endpointsharetweet
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); });
Loading…

no comments

    sign in to comment