Permalink
Browse files

add function comments and fixed demo options.

  • Loading branch information...
1 parent 14d56fd commit 1be2883f48da6bafc33a5c725862beaa83d062a9 @fengmk2 fengmk2 committed Aug 20, 2012
Showing with 15 additions and 2 deletions.
  1. +2 −0 .npmignore
  2. +2 −1 README.md
  3. +1 −1 example/demo.js
  4. +10 −0 lib/onehost.js
View
@@ -0,0 +1,2 @@
+test/
+Makefile
View
@@ -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}));
View
@@ -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}));
View
@@ -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 || {};

0 comments on commit 1be2883

Please sign in to comment.