express-subdomains
Advanced tools
Comparing version 0.0.3 to 0.0.4
51
index.js
@@ -0,51 +1,2 @@ | ||
module.exports = require('./lib/subdomains') | ||
/*! | ||
* express-subdomains | ||
* Copyright(c) Thomas Blobaum | ||
* MIT Licensed | ||
*/ | ||
var subs = [{base:'.'}] | ||
var Sequence = require('sequence'); | ||
module.exports = { | ||
use: function (base, options) { | ||
options = options || {} | ||
subs.unshift({ | ||
base:base, | ||
options:options | ||
}) | ||
return this | ||
}, | ||
middleware: function (req, res, next) { | ||
forEachAsync(subs, function(fn, item, i, arr) { | ||
if (RegExp(item.base, "gi").test(req.headers.host)) { | ||
if (item.base !== '.') req.url = '/' + item.base + req.url | ||
next() | ||
} | ||
else { | ||
fn() | ||
} | ||
}) | ||
} | ||
} | ||
function forEachAsync (arr, callback) { | ||
var sequence = Sequence() | ||
function handleItem(item, i, arr) { | ||
sequence.then(function (next) { | ||
callback(next, item, i, arr) | ||
}) | ||
} | ||
arr.forEach(handleItem) | ||
return sequence | ||
} | ||
@@ -5,9 +5,10 @@ { | ||
"description": "subdomain support for express", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"homepage": "https://github.com/tblobaum/express-subdomains", | ||
"repository": { | ||
"url": "" | ||
"type": "git", | ||
"url": "git://github.com/tblobaum/express-subdomains.git" | ||
}, | ||
"scripts": { | ||
"test": "npm test" | ||
"test": "make test" | ||
}, | ||
@@ -20,3 +21,5 @@ "engines": { | ||
}, | ||
"devDependencies": {} | ||
"devDependencies": { | ||
"mocha": "~0.10.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
5222
9
0
86
42
1