gql-module-loader

v1.0.4
<h3 align="center">GraphQL Module Loader</h3>
graphql module loader modules

GraphQL Module Loader

npm GitHub Issues GitHub Pull Requests GitHub license semantic-release


Easily modularize your GraphQL schemas

📝 Table of Contents

🏁 Getting Started

Getting started with gql-module-loader is pretty easy and straight forward.

Install the gql-module-loader package into your project:

npm i gql-module-loader

Create a module:

// modules/auth.js
const { gql } = require('apollo-server-express')

const Auth = {
  schema: {
    typeDefs: gql``,
    resolvers: {}
  }
}

module.exports = Auth

Then load the modules all together and use the combined schema:

// server.js
const { moduleLoader } = require('gql-module-loader')
const { makeExecutableSchema } = require('graphql-tools')
const { ApolloServer } = require('apollo-server-express')

const Root = require('./modules/root')
const Auth = require('./modules/auth')

const { schema } = moduleLoader([Root, Auth])

const server = new ApolloServer({
  schema: makeExecutableSchema(schema)
})

🎈 Usage

See the full docs here.

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

  • Hat tip to anyone whose code was used
npm i gql-module-loader

Metadata

  • MIT
  • Whatever
  • eventOne Labs
  • released 6/25/2021

Downloads

Maintainers