Skip to content

Commit

Permalink
fixing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tblobaum committed Dec 16, 2011
1 parent 182c8bd commit 51aab1b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions index.js
Expand Up @@ -5,24 +5,23 @@
* MIT Licensed
*/

var subs = []
var subs = [{base:'*'}]

module.exports = {
use: function (base, options) {
options = options || {}
subs.push({
subs.unshift({
base:base,
options:options
})
},
middleware: function (req, res, next) {
subs.forEach(function(subdomain) {
if (subdomain.base.test(req.headers.host)) {
if (RegExp(subdomain.base, "gi").test(req.headers.host)) {
req.url = '/' + subdomain.base + req.url
return next()
}
})
return next()
}
}

0 comments on commit 51aab1b

Please sign in to comment.