UNPKG

1.33 kBTypeScriptView Raw
1import express from 'express';
2import corsMiddleware from 'cors';
3import { OptionsJson } from 'body-parser';
4import { GraphQLOptions, ApolloServerBase, Config } from 'apollo-server-core';
5export { GraphQLOptions } from 'apollo-server-core';
6export interface GetMiddlewareOptions {
7 path?: string;
8 cors?: corsMiddleware.CorsOptions | corsMiddleware.CorsOptionsDelegate | boolean;
9 bodyParserConfig?: OptionsJson | boolean;
10 onHealthCheck?: (req: express.Request) => Promise<any>;
11 disableHealthCheck?: boolean;
12 __internal_healthCheckPath?: string | null;
13}
14export interface ServerRegistration extends GetMiddlewareOptions {
15 app: express.Application;
16}
17export interface ExpressContext {
18 req: express.Request;
19 res: express.Response;
20}
21export declare type ApolloServerExpressConfig = Config<ExpressContext>;
22export declare class ApolloServer<ContextFunctionParams = ExpressContext> extends ApolloServerBase<ContextFunctionParams> {
23 createGraphQLServerOptions(req: express.Request, res: express.Response): Promise<GraphQLOptions>;
24 applyMiddleware({ app, ...rest }: ServerRegistration): void;
25 getMiddleware({ path, cors, bodyParserConfig, disableHealthCheck, onHealthCheck, __internal_healthCheckPath, }?: GetMiddlewareOptions): express.Router;
26}
27//# sourceMappingURL=ApolloServer.d.ts.map
\No newline at end of file