Mongoose to Graphql
Converts a Mongoose schema to its GraphQL representation.
Install
$ npm install --save mongoose-to-graphql
Usage
; MongooseToGraphqltype type: String required: true; // [String]! ; // type Book { // title: String // category: Float // }
API
MongooseToGraphQL ( ...args )
Calls .schema
with ...args
.
.schema ( name: string, schema: {} | mongoose.Schema ): string
Converts an object or a Mongoose schema to its GraphQL string representation.
.model ( model: Function ): string
Converts a Mongoose model to its GraphQL string representation.
.plainObject ( obj: {} ): string
Converts a plain object to its GraphQL string representation.
.type ( type: any ): string
Converts a supported type to its GraphQL string representation, or throws an error.
Related
- 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.
- mongease-graphql-builder - Module for auto-generating simple GraphQL queries from Mongease descriptions.
License
MIT © Fabio Spampinato