Skip to content

Instantly share code, notes, and snippets.

@colinfwren
Created January 22, 2022 20:04
Show Gist options
  • Save colinfwren/430722b7cb578d9cd7bd7b40eb888ab0 to your computer and use it in GitHub Desktop.
Save colinfwren/430722b7cb578d9cd7bd7b40eb888ab0 to your computer and use it in GitHub Desktop.
Loading GraphQL schema from Library
import {loadTypedefsSync} from "@graphql-tools/load";
import {GraphQLFileLoader} from "@graphql-tools/graphql-file-loader";
const sources = loadTypedefsSync("node_modules/@your-org/graphql-schema/schema.graphql", {
loaders: [new GraphQLFileLoader()],
});
const typeDefs = sources.map((source) => source.document);
const resolvers = {}
const graphQLConfig = {
typeDefs,
resolvers,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment