@@ -3,14 +3,12 @@ id: api
33title : API Reference
44---
55
6-
7-
86## CONTEXT
7+
98[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/application/tokens.ts )
109
1110` CONTEXT ` is an InjectionToken representing the provided ` GraphQLModules.GlobalContext `
1211
13-
1412``` typescript
1513import { CONTEXT , Inject , Injectable } from ' graphql-modules' ;
1614
@@ -21,80 +19,74 @@ export class Data {
2119```
2220
2321## MODULE_ID
22+
2423[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/module/tokens.ts )
2524
2625` MODULE_ID ` is an InjectionToken representing module's ID
2726
28-
2927``` typescript
3028import { MODULE_ID , Inject , Injectable } from ' graphql-modules' ;
3129
3230@Injectable ()
3331export class Data {
3432 constructor (@Inject (MODULE_ID ) moduleId : string ) {
35- console .log (` Data used in ${moduleId } module ` )
33+ console .log (` Data used in ${moduleId } module ` );
3634 }
3735}
3836```
3937
4038## Application
39+
4140[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/application/types.ts )
4241
4342A return type of ` createApplication ` function.
4443
45- - ` typeDefs ` - A list of type definitions defined by modules.
46- - ` resolvers ` - An object with resolve functions defined by modules.
47- - ` schema ` - Ready to use GraphQLSchema object combined from modules.
48- - ` injector ` - The application (Singleton) injector.
49- - ` createOperationController ` - Take over control of GraphQL Operation
50- - ` createSubscription ` - Creates a ` subscribe ` function that runs the subscription phase of GraphQL.
51- Important when using GraphQL Subscriptions.
52- - ` createExecution ` - Creates a ` execute ` function that runs the execution phase of GraphQL.
53- Important when using GraphQL Queries and Mutations.
54- - ` createSchemaForApollo ` - Experimental
55- - ` createApolloExecutor ` - Experimental
56-
57-
44+ - ` typeDefs ` - A list of type definitions defined by modules.
45+ - ` resolvers ` - An object with resolve functions defined by modules.
46+ - ` schema ` - Ready to use GraphQLSchema object combined from modules.
47+ - ` injector ` - The application (Singleton) injector.
48+ - ` createOperationController ` - Take over control of GraphQL Operation
49+ - ` createSubscription ` - Creates a ` subscribe ` function that runs the subscription phase of GraphQL.
50+ Important when using GraphQL Subscriptions.
51+ - ` createExecution ` - Creates a ` execute ` function that runs the execution phase of GraphQL.
52+ Important when using GraphQL Queries and Mutations.
53+ - ` createSchemaForApollo ` - Experimental
54+ - ` createApolloExecutor ` - Experimental
5855
5956## ApplicationConfig
57+
6058[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/application/types.ts )
6159
6260Application's configuration object. Represents the first argument of ` createApplication ` function.
6361
64- - ` modules ` - A list of GraphQL Modules
65- - ` providers ` - A list of Providers - read the [ "Providers and Tokens"] ( ./di/providers ) chapter.
66- - ` middlewares ` - A map of middlewares - read the [ "Middlewares"] ( ./advanced/middlewares ) chapter.
67- - ` schemaBuilder ` - Creates a GraphQLSchema object out of typeDefs and resolvers
68-
69-
62+ - ` modules ` - A list of GraphQL Modules
63+ - ` providers ` - A list of Providers - read the [ "Providers and Tokens"] ( ./di/providers ) chapter.
64+ - ` middlewares ` - A map of middlewares - read the [ "Middlewares"] ( ./advanced/middlewares ) chapter.
65+ - ` schemaBuilder ` - Creates a GraphQLSchema object out of typeDefs and resolvers
7066
7167## createApplication
68+
7269[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/application/application.ts )
7370
7471Creates Application out of Modules. Accepts ` ApplicationConfig ` .
7572
76-
7773``` typescript
7874import { createApplication } from ' graphql-modules' ;
7975import { usersModule } from ' ./users' ;
8076import { postsModule } from ' ./posts' ;
8177import { commentsModule } from ' ./comments' ;
8278
8379const app = createApplication ({
84- modules: [
85- usersModule ,
86- postsModule ,
87- commentsModule
88- ]
89- })
80+ modules: [usersModule , postsModule , commentsModule ],
81+ });
9082```
9183
9284## createModule
85+
9386[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/module/module.ts )
9487
9588Creates a Module, an element used by Application. Accepts ` ModuleConfig ` .
9689
97-
9890``` typescript
9991import { createModule , gql } from ' graphql-modules' ;
10092
@@ -105,19 +97,19 @@ export const usersModule = createModule({
10597 ` ,
10698 resolvers: {
10799 // ...
108- }
100+ },
109101});
110102```
111103
112104## ModuleConfig
105+
113106[ _ source file_ ] ( https://github.com/Urigo/graphql-modules/blob/master/packages/graphql-modules/src/module/types.ts )
114107
115108Module's configuration object. Represents the first argument of ` createModule ` function.
116109
117- - ` id ` - Unique identifier of a module
118- - ` dirname ` - Pass ` __dirname ` variable as a value to get better error messages.
119- - ` typeDefs ` - An object or a list of GraphQL type definitions (SDL).
120- - ` resolvers ` - An object or a list of GraphQL resolve functions.
121- - ` middlewares ` - A map of middlewares - read the [ "Middlewares"] ( ./advanced/middlewares ) chapter.
122- - ` providers ` - A list of Providers - read the [ "Providers and Tokens"] ( ./di/providers ) chapter.
123-
110+ - ` id ` - Unique identifier of a module
111+ - ` dirname ` - Pass ` __dirname ` variable as a value to get better error messages.
112+ - ` typeDefs ` - An object or a list of GraphQL type definitions (SDL).
113+ - ` resolvers ` - An object or a list of GraphQL resolve functions.
114+ - ` middlewares ` - A map of middlewares - read the [ "Middlewares"] ( ./advanced/middlewares ) chapter.
115+ - ` providers ` - A list of Providers - read the [ "Providers and Tokens"] ( ./di/providers ) chapter.
0 commit comments