Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-subdomains

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-subdomains - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

.npmignore

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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc