@dazejs/framework
Version:
Daze.js - A powerful web framework for Node.js
40 lines (39 loc) • 1.96 kB
TypeScript
/// <reference types="node" />
import Server, { ServerOptions } from 'http-proxy';
import { Request } from '../request';
export declare class HttpProxy {
private option;
private _server;
private rewriteFn;
constructor(option?: ServerOptions);
on(event: string, listener: () => void): this;
on(event: "error", listener: Server.ErrorCallback): this;
on(event: "start", listener: Server.StartCallback): this;
on(event: "proxyReq", listener: Server.ProxyReqCallback): this;
on(event: "proxyRes", listener: Server.ProxyResCallback): this;
on(event: "proxyReqWs", listener: Server.ProxyReqWsCallback): this;
on(event: "econnreset", listener: Server.EconnresetCallback): this;
on(event: "end", listener: Server.EndCallback): this;
on(event: "open", listener: Server.OpenCallback): this;
on(event: "close", listener: Server.CloseCallback): this;
once(event: string, listener: () => void): this;
once(event: "error", listener: Server.ErrorCallback): this;
once(event: "start", listener: Server.StartCallback): this;
once(event: "proxyReq", listener: Server.ProxyReqCallback): this;
once(event: "proxyRes", listener: Server.ProxyResCallback): this;
once(event: "proxyReqWs", listener: Server.ProxyReqWsCallback): this;
once(event: "econnreset", listener: Server.EconnresetCallback): this;
once(event: "end", listener: Server.EndCallback): this;
once(event: "open", listener: Server.OpenCallback): this;
once(event: "close", listener: Server.CloseCallback): this;
getServer(): Server<import("http").IncomingMessage, import("http").ServerResponse>;
changeOrigin(flag?: boolean): this;
ws(flag?: boolean): this;
secure(flag?: boolean): this;
target(target: ServerOptions['target']): this;
rewrite(fn: (path: string) => string): this;
headers(headers: {
[header: string]: string;
}): this;
output(request: Request): Promise<void>;
}