@h4ad/serverless-adapter
Version:
Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.
63 lines (60 loc) • 2.64 kB
TypeScript
import { RequestListener } from 'http';
import { Server } from 'node:http';
import { H as HandlerContract, B as BinarySettings, S as ServerlessHandler } from '../../handler.contract-Ckhqvom_.js';
import { A as AdapterContract, R as ResolverContract } from '../../adapter.contract-FnS-TPRj.js';
import { F as FrameworkContract } from '../../framework.contract-td-lRvq6.js';
import { I as ILogger } from '../../logger-F8qccesk.js';
import '../../headers-DjfGHDmI.js';
/**
* The default port that huawei will proxy the request to your framework
*
* {@link https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096 | Reference}
*
* @breadcrumb Handlers / HttpHuaweiHandler
* @public
*/
declare const DEFAULT_HUAWEI_LISTEN_PORT: number;
/**
* The options to customize {@link HttpHuaweiHandler}
*
* @breadcrumb Handlers / HttpHuaweiHandler
* @public
*/
type HttpHuaweiHandlerOptions = {
/**
* @defaultValue {@link DEFAULT_HUAWEI_LISTEN_PORT}
*/
port?: number;
/**
* The factory to create a http server to use to listen huawei requests
*/
httpServerFactory?: (requestListener: RequestListener) => Server;
};
/**
* The class that implements a huawei serverless handler with http function that exposes a http server in specific port.
*
* In this Handler, you don't need to specific resolver and adapter, so you can use DummyAdapter and DummyResolver instead.
*
* @see https://support.huaweicloud.com/intl/en-us/ae-ad-1-usermanual-functiongraph/functiongraph_01_1442.html#functiongraph_01_1442__li194597302096
*
* @breadcrumb Handlers / HttpHuaweiHandler
* @public
*/
declare class HttpHuaweiHandler<TApp> implements HandlerContract<TApp, void, void, void, void, Promise<void>> {
protected readonly options?: HttpHuaweiHandlerOptions | undefined;
/**
* Construtor padrão
*/
constructor(options?: HttpHuaweiHandlerOptions | undefined);
/**
* {@inheritDoc}
*/
getHandler(app: TApp, framework: FrameworkContract<TApp>, _adapters: AdapterContract<void, void, void>[], _resolver: ResolverContract<void, void, void, void, void>, _binarySettings: BinarySettings, _respondWithErrors: boolean, log: ILogger): ServerlessHandler<Promise<void>>;
/**
* The method that creates the instance of http server
*
* @param requestListener - O método que lidará com as requisições recebidas
*/
protected createHttpServer(requestListener: RequestListener): Server;
}
export { DEFAULT_HUAWEI_LISTEN_PORT, HttpHuaweiHandler, type HttpHuaweiHandlerOptions };