1
1
var http = require ( 'http' ) ,
2
2
https = require ( 'https' ) ,
3
3
url = require ( 'url' ) ,
4
- httpProxy = require ( './http-proxy/' ) ,
5
- proxy = exports ;
4
+ httpProxy = require ( './http-proxy/' ) ;
5
+
6
+ /**
7
+ * Export the "Server" so we can have an intuitive api for just creating
8
+ * a proxy
9
+ *
10
+ */
11
+ module . exports = httpProxy . Server ;
6
12
7
13
/**
8
14
* Creates the proxy server.
@@ -19,23 +25,23 @@ var http = require('http'),
19
25
* @api public
20
26
*/
21
27
22
- proxy . createProxyServer = proxy . createServer = function createProxyServer ( options ) {
28
+ module . exports . createProxyServer = module . exports . createServer = function createProxyServer ( options ) {
23
29
/*
24
30
* `options` is needed and it must have the following layout:
25
- *
26
- * {
27
- * target : <url string to be parsed with the url module>
28
- * forward: <url string to be parsed with the url module>
29
- * agent : <object to be passed to http(s).request>
30
- * ssl : <object to be passed to https.createServer()>
31
+ *
32
+ * {
33
+ * target : <url string to be parsed with the url module>
34
+ * forward: <url string to be parsed with the url module>
35
+ * agent : <object to be passed to http(s).request>
36
+ * ssl : <object to be passed to https.createServer()>
31
37
* ws : <true/false, if you want to proxy websockets>
32
- * xfwd : <true/false, adds x-forward headers>
38
+ * xfwd : <true/false, adds x-forward headers>
33
39
* secure : <true/false, verify SSL certificate>
34
- * }
35
- *
36
- * NOTE: `options.ws` and `options.ssl` are optional.
37
- * `options.target and `options.forward` cannot be
38
- * both missing
40
+ * }
41
+ *
42
+ * NOTE: `options.ws` and `options.ssl` are optional.
43
+ * `options.target and `options.forward` cannot be
44
+ * both missing
39
45
* }
40
46
*/
41
47
0 commit comments