UNPKG

@litert/televoke

Version:
52 lines 2.21 kB
/** * Copyright 2025 Angus.Fenying <fenying@litert.org> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type * as Listener from '../http-listener'; import type * as Http from 'node:http'; import type * as dT from '../Transporter.decl'; export interface IHttpGatewayOptions { hostname?: string; port?: number; backlog?: number; } export interface IRegisterListenerOptions { onErrorCallback: (e: Error) => void; onRequestCallback: (req: Http.IncomingMessage, resp: Http.ServerResponse) => void; } export interface IRegisterListenerResult { stop?: () => void | Promise<void>; start?: () => void | Promise<void>; readonly running: boolean; } /** * Create a legacy HTTP gateway, binding to a built-in simple HTTP server. * * > When using built-in HTTP server, the api will ignore headers, path and query string in the URL. * * @param listener The built-in HTTP listener to bind to. * @param server The server to process the requests. */ export declare function createLegacyHttpGateway(listener: Listener.IHttpListener, server: dT.IServer): dT.IGateway; /** * Create a legacy HTTP gateway, binding to a custom HTTP server. * * > When using a custom HTTP server, it's able to preprocess the request before passing to the server, like * > authentication, rate limiting, etc. * * @param registerListener The function to register the listener to the custom HTTP server. * @param server The server to process the requests. */ export declare function createCustomLegacyHttpGateway(registerListener: (opts: IRegisterListenerOptions) => IRegisterListenerResult, server: dT.IServer): dT.IGateway; //# sourceMappingURL=LegacyHttp.Server.d.ts.map