1.0.8 • Published 4 years ago

mongo-graphql v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Mongo GraphQL

Mongo GraphQL is a package to very quickly start a GraphQL with Mongodb app. It directly uses mongoose as an ODM.

Example

const { App } = require("mongo-graphql")

new App({
  architecture: {
    [__dirname]: {
      schemas: ["schemas"],
      resolvers: {
        "*.resolvers": ["resolvers"],
      },
    },
  },
})

All your resolvers file must be named like this pattern

<type>.<name>.<extension>

examples:

  • query.users.js
  • query.user.js
  • mutation.newUser.js
  • mutation.newEvent.js
  • author.book this will be set as a field resolver

Your architecture would look like this

architecture demo

with app.js looking this this:

const { App } = require("mongo-graphql")

new App({
  architecture: {
    [__dirname]: {
      schema: ["schemas"],
      routes: {
        "*.resolvers": ["resolvers"],
      },
    },
  },
})

It's all you need to start a project!

You can still add configurations to it, but that is the minimal for it to start working!

You can make some quite complex architecture!

const { App } = require("mongo-graphql")

new App({
  mongodb: "mongodb://localhost:27017/playground", // defaults to "mongodb://localhost:27017/app"
  port: 5600, // defaults to 4500
  debug: true, // defaults to false, it logs the found resolvers
  architecture: {
    [__dirname]: {
      folders: {
        what: {
          schemas: ["schemas"],
        },
      },
      controllers: {
        "controller-*": ["resolvers"],
      },
    },
  },
})

Try it out! 😎

npm install mongo-graphql
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago