Commit 2f49810e authored by indexzero's avatar indexzero

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

parent 994f7481
# 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
......@@ -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
......
/*
* 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);
......
{
"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" }
......
/*
* 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);
......
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