Module for auto-generating simple GraphQL queries from Mongease descriptions.
$ npm install --save mongease-graphql-builder
import Mongease from 'mongease';
import MongeaseGraphQL from 'mongease-graphql';
import Builder from 'mongease-graphql-builder';
Mongease.plugin ( MongeaseGraphQL.make );
Mongease.make ( 'Book', {
schema: {
title: String,
category: Number,
read: Boolean
},
resolvers: {
Query: {
findBooks () {}
},
Mutation: {
bookMarkAsRead () {}
}
}
});
Builder.query ( 'findBooks', true ); // GraphQL query as string
Builder.mutation ( 'bookMarkAsRead' ) // GraphQL-ready mutation
Creates and returns a GraphQL query, given the name of the resolver.
Creates and returns a GraphQL mutation, given the name of the resolver.
Creates and returns a GraphQL subscription, given the name of the resolver.
- mongoose-to-graphql - Converts a Mongoose schema to its GraphQL representation.
- mongease - Tiny wrapper around Mongoose for easier creation of schemas and models. Supports plugins.
- mongease-graphql - Mongease plugin for adding support to GraphQL schemas creation.
MIT © Fabio Spampinato