Next Perpendicular Moonlanding

npm

Need private packages and team management tools?Check out npm Orgs. »

graphql-makers

0.0.3 • Public • Published

GraphQL Makers

Functions to make GraphQL types based on schema-language definitions.

npm version

WARNING: This is a work-in-progress. It has been briefly tested but only on a recent version of Node/GraphQL.js and for limited use cases.

Examples

Create a GraphQLObjectType object

const { objectType } = require('graphql-makers');
 
const dependencies = {
  Comment: require.resolve('./comment'),
};
 
const typeDef = `
  type Post {
    id: ID
    title: String
    content: String
    user: User
    comments: [Comment]
  }
`;
 
const resolvers = {
  user(parent, args, contex) {
    // ...
  },
  comments(parent, args, context) {
    // ...
  },
};
 
module.exports = objectType({ typeDef, resolvers, dependencies });

Create a GraphQLSchema object

const typeDef = `
  type Query {
    list: [Int!]!
  }
`;
 
const resolvers = {
  Query: {
    list: () => [1, 2, 3],
  },
};
 
module.exports = schemaType({ typeDef, resolvers, dependencies });

License

GraphQL Makers is MIT licensed.

Keywords

none

install

npm i graphql-makers

Downloadsweekly downloads

4

version

0.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability