Permalink
Browse files

[dist] Renamed node-proxy to node-http-proxy, updated package.json

  • Loading branch information...
indexzero committed Jul 27, 2010
1 parent 994f748 commit 2f49810ef86f49927991f32ae42605f1118b0c25
Showing with 27 additions and 23 deletions.
  1. +11 −7 README.md
  2. +3 −3 demo.js
  3. +4 −7 lib/{node-proxy.js → node-http-proxy.js}
  4. +5 −2 package.json
  5. +4 −4 test/{node-proxy-test.js → node-http-proxy-test.js}
View
@@ -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.
+
+### Installing 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.
+<pre>
+ npm install http-proxy
+</pre>
-### how to use node-http-proxy
+### How to use node-http-proxy
View
@@ -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
@@ -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);
View
@@ -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 <charlie.robbins@gmail.com>",
"contributors": [
{ "name": "Marak Squires", "email": "marak.squires@gmail.com" },
],
"keywords": ["reverse", "proxy", "http"],
+ "dependencies": {
+ "colors": ">= 0.0.1"
+ },
"directories": { "lib" },
"scripts": { "test": "vows" },
"engines": { "node": ">= 0.1.98" }
@@ -1,5 +1,5 @@
/*
- * node-proxy-test.js: Tests for node-proxy. Reverse proxy for node.js
+ * node-http-proxy-test.js: Tests for node-http-proxy. Reverse proxy for node.js
*
* (C) 2010 Charlie Robbins
* MIT LICENSE
@@ -13,7 +13,7 @@ var vows = require('vows'),
require.paths.unshift(require('path').join(__dirname, '../lib/'));
-var NodeProxy = require('node-proxy').NodeProxy;
+var HttpProxy = require('node-http-proxy').HttpProxy;
var testServers = {};
//
@@ -89,7 +89,7 @@ vows.describe('node-proxy').addBatch({
"When an incoming request is proxied to the helloNode server" : {
"with no latency" : {
topic: function () {
- var proxy = new (NodeProxy);
+ var proxy = new (HttpProxy);
startTest(proxy, 8082);
proxy.emitter.addListener('end', this.callback);
@@ -106,7 +106,7 @@ vows.describe('node-proxy').addBatch({
},
"with latency": {
topic: function () {
- var proxy = new (NodeProxy);
+ var proxy = new (HttpProxy);
startTestWithLatency(proxy, 8083);
proxy.emitter.addListener('end', this.callback);

0 comments on commit 2f49810

Please sign in to comment.