@@ -4,27 +4,27 @@ This is a plugin for [graphql-compose](https://github.com/nodkz/graphql-compose)
44
55Example
66=======
7-
7+ Can be found here https://github.com/nodkz/graphql-compose-mongoose-example
88``` js
9- import { Schema } from ' mongoose' ;
9+ import mongoose from ' mongoose' ;
1010import mongooseToTypeComposer from ' graphql-compose-mongoose' ;
1111import { GraphQLSchema , GraphQLObjectType } from ' graphql' ;
1212
1313// STEP 1: DEFINE MONGOOSE SCHEMA AND MODEL
14- const LanguagesSchema = new Schema ({
14+ const LanguagesSchema = new mongoose. Schema ({
1515 language: String ,
1616 skill: {
1717 type: String ,
1818 enum: [ ' basic' , ' fluent' , ' native' ],
1919 },
2020});
2121
22- const UserSchema = new Schema ({
22+ const UserSchema = new mongoose. Schema ({
2323 name: String , // standard types
2424 age: {
2525 type: Number ,
2626 index: true ,
27- }
27+ },
2828 languages: {
2929 type: [LanguagesSchema], // you may include other schemas (here included as array of embedded documents)
3030 default: [],
@@ -79,6 +79,8 @@ const graphqlSchema = new GraphQLSchema({
7979 },
8080 }),
8181});
82+
83+ export default graphqlSchema ;
8284```
8385That's all!
8486You think that is to much code?
@@ -213,7 +215,7 @@ This module in near future allow to combine any complexity of your GraphQL schem
213215- And may be using graphql on server side for API calls to different services (have such amazing thoughts ;).
214216- and much much more
215217
216- ## SO, FUTURE OF CRAZY GRAPHQL SCHEMAS NOT SO FAR
218+ ## SO, THE FUTURE OF CRAZY GRAPHQL SCHEMAS IS NOT SO FAR
217219
218220
219221TODO
0 commit comments