diff --git a/README.md b/README.md index e618926..4a3201f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # node-http-proxy - v0.1.0 -## battle-hardened node.js http reverse proxy +## Battle-hardened node.js http reverse proxy - - -###features +### Features - reverse-proxies incoming http.Server requests - can be used as a CommonJS module in node.js @@ -16,8 +14,14 @@ - written entirely in javascript - easy to use api -###when to use node-http-proxy +### When to use node-http-proxy -let's suppose you were running multiple http application servers, but you only wanted to expose one machine to the internet. you could setup node-http-proxy on that one machine and then reverse-proxy the incoming http requests to locally running services which were not exposed to the outside network. +Let's suppose you were running multiple http application servers, but you only wanted to expose one machine to the internet. You could setup node-http-proxy on that one machine and then reverse-proxy the incoming http requests to locally running services which were not exposed to the outside network. -### how to use node-http-proxy +### Installing node-http-proxy + +
+ npm install http-proxy ++ +### How to use node-http-proxy diff --git a/demo.js b/demo.js index 33e2ad5..dbba15e 100644 --- a/demo.js +++ b/demo.js @@ -12,14 +12,14 @@ var vows = require('vows'), assert = require('assert'), http = require('http'); -var NodeProxy = require('./lib/node-proxy').NodeProxy; +var HttpProxy = require('./lib/node-http-proxy').HttpProxy; var testServers = {}; // regular http server http.createServer(function (req, res){ // Initialize the nodeProxy and start proxying the request - var proxy = new (NodeProxy); + var proxy = new (HttpProxy); proxy.init(req, res); // lets proxy the request to another service proxy.proxyRequest('localhost', '8081', req, res); @@ -30,7 +30,7 @@ sys.puts('started a http server on port 8080'.green) // http server with latency http.createServer(function (req, res){ // Initialize the nodeProxy and start proxying the request - var proxy = new (NodeProxy); + var proxy = new (HttpProxy); proxy.init(req, res); // lets proxy the request to another service diff --git a/lib/node-proxy.js b/lib/node-http-proxy.js similarity index 94% rename from lib/node-proxy.js rename to lib/node-http-proxy.js index 274d98b..882cc8a 100644 --- a/lib/node-proxy.js +++ b/lib/node-http-proxy.js @@ -1,5 +1,5 @@ /* - * node-proxy.js: Reverse proxy for node.js + * node-http-proxy.js: Reverse proxy for node.js * * (C) 2010 Charlie Robbins * MIT LICENSE @@ -10,21 +10,18 @@ var sys = require('sys'), http = require('http'), events = require('events'); -// -// The NodeProxy factory -// -exports.NodeProxy = function () { +exports.HttpProxy = function () { var self = this; this.emitter = new(events.EventEmitter); // If we were passed more than two arguments, - // assume they are request and response. + // assume the first two are request and response. if(arguments.length >= 2) { this.init(arguments[0], arguments[1]); } }; -exports.NodeProxy.prototype = { +exports.HttpProxy.prototype = { toArray: function (obj){ var len = obj.length, arr = new Array(len); diff --git a/package.json b/package.json index 11713b6..98cc5e8 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,15 @@ { - "name": "node-http-proxy", + "name": "http-proxy", "description": "A full-featured http reverse proxy for node.js", - "version": "0.5.0", + "version": "0.1.0", "author": "Charlie Robbins