1.6.0 • Published 2 years ago

gql-autoloader v1.6.0

Weekly downloads
1
License
ISC
Repository
github
Last release
2 years ago

gql-autoloader

gql-autloader aims to make it faster and simpler to autload typedefs and resolvers when breaking up schemas.

How to use gql-autoloader

You can use gql-autoloader preferably with Apollo Server. We need to define "empty" typeDefs to be able to extend dynamically. (This is true right now, maybe not in later versions of Apollo Server)

const { ApolloServer, gql } = require('apollo-server')
const { makeExecutableSchema } = require('graphql-tools')
const path = require('path')
const gqlAutoloader = require('gql-autoloader')

const typeDefs = gql`
  type Query {
    _empty: String
  }

  type Mutation {
    _empty: String
  }

  type Subscription {
    _empty: String
  }
`

const schema = makeExecutableSchema(
  gqlAutoloader({
    dir: path.join(__dirname, './gql'),
    typeDefs
  })
)

const apollo = new ApolloServer({
  ...
  schema,
  ...
})

Changelog

1.3.0 - Handle undefined typeDefs or resolvers in files 1.2.0 - Filter files that does'nt export resolvers or typeDefs 1.1.0 - Adds recursively autoload 1.0.1 - Readme update 1.0.0 - Initial release

1.6.0

2 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago