Skip to Content
GraphQL-Config

GraphQLConfig

The GraphQLConfig object is instantiated by calling loadConfig.

A basic usage:

import { loadConfig } from 'graphql-config' async function main() { const config = await loadConfig({ ... }) // an instance of GraphQLConfig }

API

filepath

type: string

An exact path of a config file.

dirpath

type: string

A path of a directory where GraphQL Config was found.

extensions

type: GraphQLExtensionsRegistry

A registry of provided extensions.

projects

type: { [projectName: string]: GraphQLProjectConfig }

A key-value object where the key is a project’s name but the value contains GraphQLProjectConfig object.

getProject()

type: getProject(name?: string): GraphQLProjectConfig | never

Accepts a single argument, which is a project’s name and returns that project. When no name is provided, it resolves with a default project.

getDefault()

type: getDefault(): GraphQLProjectConfig | never

Returns a default project.

getProjectForFile()

type: getProjectForFile(filepath: string): GraphQLProjectConfig | never

Allows getting projects based on a file path. It might be a path to a GraphQL file that contains SDL or Operations and Fragments but also any file included in the project.

Last updated on