Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tblobaum committed Dec 16, 2011
0 parents commit b5d3c39
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
28 changes: 28 additions & 0 deletions index.js
@@ -0,0 +1,28 @@

/*!
* express-subdomains
* Copyright(c) Thomas Blobaum
* MIT Licensed
*/

var subs = []

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

18 changes: 18 additions & 0 deletions package.json
@@ -0,0 +1,18 @@
{
"author": "Thomas Blobaum <tblobaum@gmail.com> (https://github.com/tblobaum)",
"name": "express-subdomains",
"description": "subdomain support for express",
"version": "0.0.2",
"homepage": "https://github.com/tblobaum/express-subdomains",
"repository": {
"url": ""
},
"scripts": {
"test": "npm test"
},
"engines": {
"node": "~0.6.1"
},
"dependencies": {},
"devDependencies": {}
}

0 comments on commit b5d3c39

Please sign in to comment.