Skip to content

Commit efcd8a3

Browse files
committed
add static methods for compatibility
1 parent 108cfd5 commit efcd8a3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

lib/http-proxy/index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,33 @@ export class ProxyServer extends EventEmitter {
122122
this.on("error", this.onError);
123123
}
124124

125+
/**
126+
* Creates the proxy server with specified options.
127+
* @param options Config object passed to the proxy
128+
* @returns Proxy object with handlers for `ws` and `web` requests
129+
*/
130+
static createProxyServer(options?: ServerOptions): ProxyServer {
131+
return new ProxyServer(options);
132+
}
133+
134+
/**
135+
* Creates the proxy server with specified options.
136+
* @param options Config object passed to the proxy
137+
* @returns Proxy object with handlers for `ws` and `web` requests
138+
*/
139+
static createServer(options?: ServerOptions): ProxyServer {
140+
return new ProxyServer(options);
141+
}
142+
143+
/**
144+
* Creates the proxy server with specified options.
145+
* @param options Config object passed to the proxy
146+
* @returns Proxy object with handlers for `ws` and `web` requests
147+
*/
148+
static createProxy(options?: ServerOptions): ProxyServer {
149+
return new ProxyServer(options);
150+
}
151+
125152
// createRightProxy - Returns a function that when called creates the loader for
126153
// either `ws` or `web`'s passes.
127154
createRightProxy = (type: ProxyType): Function => {

0 commit comments

Comments
 (0)