UNPKG

1.38 kBTypeScriptView Raw
1import http from 'http';
2import { Handler, Event, Response } from './lambda';
3import { Config } from './config';
4import { Hooks } from './createEmitter';
5export interface HttpError extends Error {
6 statusCode?: number;
7 message: string;
8}
9export declare function createHttpError(statusCode: number, message: string): HttpError;
10export declare function getMimeType(response: Response): string;
11export declare function loadLambdaFroManifest(url: string, manifest: {
12 [route: string]: string;
13}): {
14 handler: Handler;
15};
16export declare function processHandler(event: Event, lambda: {
17 handler: Handler;
18}): Promise<{
19 statusCode: number;
20 headers?: {
21 [header: string]: string | number | boolean;
22 } | undefined;
23 multiValueHeaders?: {
24 [header: string]: readonly (string | number | boolean)[];
25 } | undefined;
26 body?: string | undefined;
27 isBase64Encoded?: boolean | undefined;
28}>;
29export declare function createRequestHandler({ port, config }: {
30 port: number;
31 config: Config;
32}): (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
33export declare function createServerHandler({ port, config }: {
34 port: number;
35 config: Config;
36}): (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
37export declare function serve(config: Config, hooks: Hooks): {
38 close(): Promise<unknown>;
39};