Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
add function comments and fixed demo options.
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Aug 20, 2012
1 parent 14d56fd commit 1be2883
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/
Makefile
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var onehost = require('onehost');

var app = connect(
onehost({
toHost: 'localhost.cnodejs.org'
host: 'localhost.cnodejs.org',
// exclude: 'dev.cnodejs.org',
}),
function (req, res) {
res.end(JSON.stringify({headers: req.headers, url: req.url}));
Expand Down
2 changes: 1 addition & 1 deletion example/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var onehost = require('../');

var app = connect(
onehost({
toHost: 'localhost'
host: 'localhost'
}),
function (req, res) {
res.end(JSON.stringify({headers: req.headers, url: req.url}));
Expand Down
10 changes: 10 additions & 0 deletions lib/onehost.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
* Module dependencies.
*/

/**
* One host binding middleware.
*
* @param {Object} options
* - {String} host, which host should be binding.
* - {Array|String} [exclude], ignore hosts, they won't be handle.
* e.g.: 'abc.com' or `['abc.com', 'dec.com']`, default is `[]`.
* - {String} [protocol], http or https, default is http.
* @return {Function(req, res, next)} middleware function.
*/
module.exports = function onehost(options) {
var EXCLUDE_HOST_RE = null;
options = options || {};
Expand Down

0 comments on commit 1be2883

Please sign in to comment.