ApolloService
@tsed/apollo
Usage
typescript
import { ApolloService } from "@tsed/apollo";
See /packages/graphql/apollo/src/types/services/ApolloService.ts.
Overview
ts
class ApolloService {
platformName: string;
protected logger: Logger;
protected servers: Map<string, {
instance: ApolloServer<ApolloContext>;
schema?: GraphQLSchema;
typeDefs?: IExecutableSchemaDefinition<ApolloContext>["typeDefs"];
resolvers?: IExecutableSchemaDefinition<ApolloContext>["resolvers"];
}>;
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer<ApolloContext>>;
get(id?: string): ApolloServer<ApolloContext> | undefined;
getSchema(id?: string): GraphQLSchema | undefined;
getTypeDefs(id?: string): import("@graphql-tools/utils").TypeSource | undefined;
getResolvers(id?: string): import("@graphql-tools/utils").IResolvers<any, ApolloContext> | import("@graphql-tools/utils").IResolvers<any, ApolloContext>[] | undefined;
has(id?: string): boolean;
createContextHandler(server: ApolloServer<ApolloContext>, settings: ApolloSettings): () => Promise<any>;
protected createInstance(options: ApolloServerOptions<ApolloContext>, server?: ApolloCustomServerCB<ApolloContext>): ApolloServer<ApolloContext>;
}
platformName
ts
platformName: string;
protected logger
ts
protected logger: Logger;
protected servers
ts
protected servers: Map<string, {
instance: ApolloServer<ApolloContext>;
schema?: GraphQLSchema;
typeDefs?: IExecutableSchemaDefinition<ApolloContext>["typeDefs"];
resolvers?: IExecutableSchemaDefinition<ApolloContext>["resolvers"];
}>;
createServer
ts
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer<ApolloContext>>;
get
ts
get(id?: string): ApolloServer<ApolloContext> | undefined;
Get an instance of ApolloServer from his id
getSchema
ts
getSchema(id?: string): GraphQLSchema | undefined;
Get schema of the ApolloServer from his id
getTypeDefs
ts
getTypeDefs(id?: string): import("@graphql-tools/utils").TypeSource | undefined;
Get TypeDefs of the ApolloServer from his id
getResolvers
ts
getResolvers(id?: string): import("@graphql-tools/utils").IResolvers<any, ApolloContext> | import("@graphql-tools/utils").IResolvers<any, ApolloContext>[] | undefined;
has
ts
has(id?: string): boolean;
createContextHandler
ts
createContextHandler(server: ApolloServer<ApolloContext>, settings: ApolloSettings): () => Promise<any>;
create a new dataSources function to use with apollo server config
protected createInstance
ts
protected createInstance(options: ApolloServerOptions<ApolloContext>, server?: ApolloCustomServerCB<ApolloContext>): ApolloServer<ApolloContext>;