How to use the merge-graphql-schemas.fileLoader 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 WhatTheFar / modularizing-graphql-boilerplate / src / typeDefs.ts View on Github external
export const generateTypeDefs = () => {
	const typesArray = fileLoader(join(__dirname, './**/!(generated)/*.graphql'));

	const typeDefs = `
# import * from "prisma.graphql"

scalar Upload
scalar DateTime

${FieldValidationError}
${MutationValidationError}
${mergeTypes(typesArray, { all: true })}
`;

	writeFileSync(join(__dirname, 'generated', 'schema.graphql'), typeDefs);
};
github mrdulin / apollo-server-express-starter / src / n+1 / graphql / modules / index.ts View on Github external
import path from 'path';
import { fileLoader, mergeResolvers, mergeTypes } from 'merge-graphql-schemas';
import { makeExecutableSchema } from 'graphql-tools';

const resolversArray = fileLoader(path.join(__dirname, './**/*.resolvers.*'));
const typesArray = fileLoader(path.join(__dirname, './**/*.graphql'));

const resolvers = mergeResolvers(resolversArray);
const typeDefs = mergeTypes(typesArray);

const schema = makeExecutableSchema({ typeDefs, resolvers });

export { schema, resolvers };
github Coding-Coach / coding-coach-api / src / schema / index.js View on Github external
import path from 'path'
import { fileLoader, mergeTypes } from 'merge-graphql-schemas'

const typesArray = fileLoader(path.join(__dirname, './'), { recursive: true })

export default mergeTypes(typesArray, { all: true })
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 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;

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