1.0.6 • Published 7 years ago

mongease-graphql-builder v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Mongease Graphql Builder

Module for auto-generating simple GraphQL queries from Mongease descriptions.

Install

$ npm install --save mongease-graphql-builder

Usage

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

API

.query ( resolver: string, string = false )

Creates and returns a GraphQL query, given the name of the resolver.

.mutation ( resolver: string, string = false )

Creates and returns a GraphQL mutation, given the name of the resolver.

.subscription ( resolver: string, string = false )

Creates and returns a GraphQL subscription, given the name of the resolver.

Related

  • 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.

License

MIT © Fabio Spampinato

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago