Skip to content

eventOneHQ/gql-module-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c4055a3 Β· Jun 25, 2021

History

14 Commits
Jun 25, 2021
Jun 25, 2021
Sep 16, 2020
Jun 19, 2019
Jun 19, 2019
Jun 19, 2019
Jun 19, 2019
Jun 19, 2019
Jun 19, 2019
Jun 20, 2019
Jun 25, 2021
Jun 25, 2021

Repository files navigation

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