UNPKG

@graphql-mesh/serve-cli

Version:
49 lines (48 loc) 1.59 kB
import type { GatewayRuntime } from '@graphql-mesh/serve-runtime'; import type { Logger } from '@graphql-mesh/types'; export interface ServerConfig { /** * Host to listen on. * * @default '127.0.0.1' on Windows, otherwise '0.0.0.0' */ host?: string; /** * Port to listen on. * * @default 4000 */ port?: number; /** * SSL Credentials for the HTTPS Server. * * If this is provided, Gateway will be over secure HTTPS instead of unsecure HTTP. */ sslCredentials?: ServerConfigSSLCredentials; /** * The size of the HTTP headers to allow * * @default 16384 */ maxHeaderSize?: number; /** * Whether to disable setting up a WebSocket server. * * @default false */ disableWebsockets?: boolean; } export interface ServerConfigSSLCredentials { key_file_name?: string; cert_file_name?: string; ca_file_name?: string; passphrase?: string; dh_params_file_name?: string; ssl_ciphers?: string; ssl_prefer_low_memory_usage?: boolean; } export interface ServerForRuntimeOptions extends ServerConfig { log: Logger; } export declare function startServerForRuntime<TContext extends Record<string, any> = Record<string, any>>(runtime: GatewayRuntime<TContext>, { log, host, port, sslCredentials, maxHeaderSize, disableWebsockets, }: ServerForRuntimeOptions): Promise<AsyncDisposable>; export declare function getGraphQLWSOptions<TContext>(gwRuntime: GatewayRuntime<TContext>): Parameters<typeof import("graphql-ws/lib/use/ws.js").useServer>[0];