@graphql-mesh/serve-cli
Version:
47 lines (46 loc) • 1.37 kB
text/typescript
import type { AppOptions, HttpRequest, HttpResponse } from 'uWebSockets.cjs';
import type { MeshServeConfig } from '@graphql-mesh/serve-runtime';
import type { Logger } from '@graphql-mesh/types';
export interface MeshServeCLIContext {
req: HttpRequest;
res: HttpResponse;
}
export type MeshServeCLIConfig = MeshServeConfig<MeshServeCLIContext> & {
/**
* Port to listen on (default: `4000`)
*/
port?: number;
/**
* Host to listen on (default: `localhost`)
*/
host?: string;
/**
* SSL Credentials for HTTPS Server
* If this is provided, Mesh will be served via HTTPS instead of HTTP.
*/
sslCredentials?: AppOptions;
/**
* The size of the HTTP headers to allow
*
* @default 16384
*/
maxHeaderSize?: number;
/**
* Path to the browser that will be used by `mesh serve` to open a playground window in development mode
* This feature can be disabled by passing `false`
*/
browser?: string | boolean;
};
/**
* Type helper for defining the config.
*/
export declare function defineConfig(config: MeshServeCLIConfig): MeshServeCLIConfig;
export interface ServerOptions {
handler: any;
log: Logger;
protocol: 'http' | 'https';
host: string;
port: number;
maxHeaderSize: number;
sslCredentials?: MeshServeCLIConfig['sslCredentials'];
}