Commit 5d6e6b9f authored by indexzero's avatar indexzero

[api] Expose adapted version of `stack` so it can be used with HttpProxy...

[api] Expose adapted version of `stack` so it can be used with HttpProxy instances not created by `httpProxy.createServer()`
parent be3a0d84
...@@ -115,10 +115,10 @@ exports.setMaxSockets = function (value) { ...@@ -115,10 +115,10 @@ exports.setMaxSockets = function (value) {
}; };
// //
// stack // ### function stack (middlewares, proxy)
// adapted from https://github.com/creationix/stack // adapted from https://github.com/creationix/stack
// //
function stack (middlewares, proxy) { exports.stack = function stack (middlewares, proxy) {
var handle; var handle;
middlewares.reverse().forEach(function (layer) { middlewares.reverse().forEach(function (layer) {
var child = handle; var child = handle;
...@@ -206,7 +206,7 @@ exports.createServer = function () { ...@@ -206,7 +206,7 @@ exports.createServer = function () {
} }
if (middleware.length > 1) { if (middleware.length > 1) {
handler = callback = stack(middleware, proxy); handler = callback = exports.stack(middleware, proxy);
} }
else if (middleware.length) { else if (middleware.length) {
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment