Skip to content

Commit c17b591

Browse files
committed
Merge pull request #536 from nodejitsu/caronte-api
export the proxy itself from the main require
2 parents e599151 + 6fa23e1 commit c17b591

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

lib/http-proxy.js

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
var http = require('http'),
22
https = require('https'),
33
url = require('url'),
4-
httpProxy = require('./http-proxy/'),
5-
proxy = exports;
4+
httpProxy = require('./http-proxy/');
5+
6+
/**
7+
* Export the the proxy "Server" as the main export
8+
*/
9+
module.exports = httpProxy.Server;
610

711
/**
812
* Creates the proxy server.
@@ -19,23 +23,23 @@ var http = require('http'),
1923
* @api public
2024
*/
2125

22-
proxy.createProxyServer = proxy.createServer = function createProxyServer(options) {
26+
module.exports.createProxyServer = module.exports.createServer = function createProxyServer(options) {
2327
/*
2428
* `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()>
29+
*
30+
* {
31+
* target : <url string to be parsed with the url module>
32+
* forward: <url string to be parsed with the url module>
33+
* agent : <object to be passed to http(s).request>
34+
* ssl : <object to be passed to https.createServer()>
3135
* ws : <true/false, if you want to proxy websockets>
32-
* xfwd : <true/false, adds x-forward headers>
36+
* xfwd : <true/false, adds x-forward headers>
3337
* 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
38+
* }
39+
*
40+
* NOTE: `options.ws` and `options.ssl` are optional.
41+
* `options.target and `options.forward` cannot be
42+
* both missing
3943
* }
4044
*/
4145

0 commit comments

Comments
 (0)