How to use the merge-graphql-schemas.mergeResolvers function in merge-graphql-schemas

To help you get started, we’ve selected a few merge-graphql-schemas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github connect-foundation / 2019-13 / back / src / schema.js View on Github external
import path from 'path';
import { makeExecutableSchema } from 'graphql-tools';
import { fileLoader, mergeResolvers, mergeTypes } from 'merge-graphql-schemas';


const allTypes = fileLoader(path.join(__dirname, 'api/**/*.graphql'));
const allResolvers = fileLoader(path.join(__dirname, 'api/**/*.js'));

const schema = makeExecutableSchema({
  typeDefs: mergeTypes(allTypes),
  resolvers: mergeResolvers(allResolvers),
});
export default schema;
github tomyitav / graphql-server-seed / graphql / schema / schema.js View on Github external
import path from "path";
import { makeExecutableSchema } from 'graphql-tools';
import { fileLoader, mergeTypes, mergeResolvers } from 'merge-graphql-schemas';

const typesArray = fileLoader(path.join(__dirname, '../types'), { recursive: true });
const resolversArray = fileLoader(path.join(__dirname, '../resolvers'));
const allTypes = mergeTypes(typesArray);
const allResolvers = mergeResolvers(resolversArray);
const schema = makeExecutableSchema({
    typeDefs: allTypes,
    resolvers: allResolvers
});

export default schema;
github RomainLanz / adonis-graphql / src / Server / index.js View on Github external
constructor (config) {
    const typeDefs = mergeTypes(fileLoader(config.get('graphql.schema'), { recursive: true }))
    const resolvers = mergeResolvers(fileLoader(config.get('graphql.resolvers')))

    this.$schema = makeExecutableSchema({ typeDefs, resolvers })

    this.$options = config.get('graphql.options') || {}
  }
github HigoRibeiro / adonis-gql / src / Server / index.js View on Github external
_loadResolversController () {
    const middleware = []
    ResolverManager.resolvers.forEach(resolver => {
      this._resolvers.push(resolver.transform())
      middleware.push(resolver.middlewares)
    })

    this._loadGlobalMiddlewares()

    this._loadNamedMiddlewares(middleware)

    this.$resolvers = mergeResolvers(this._resolvers)
  }
github cult-of-coders / graphql-load / src / index.ts View on Github external
getSchema(): GraphQLModule {
    return {
      typeDefs: mergeTypes(this.typeDefs, { all: true }),
      resolvers: mergeResolvers(this.resolvers),
    };
  }

merge-graphql-schemas

A utility library to facilitate merging of modularized GraphQL schemas and resolver objects.

MIT
Latest version published 5 years ago

Package Health Score

47 / 100
Full package analysis