Closed ssimpo closed 9 years ago
Hi! Thank you so much for the contribution! Unfortunately due to the complexity this introduces, and our similar experience with excepting arrays of strings/regexs as paths in Express, we're going to have to decline this PR. You can easily implement this functionality yourself, or even publish it to npm. For example:
var Router = require('router')
var vhost = require('vhost')
module.exports = multiVhost(arr, handle) {
var router = new Router()
arr.forEach(function (hostname) {
router.use(vhost(hostname, handle))
})
return router
}
I needed the ability to pass an array of hostnames to vhost, so tweaked the code a little to do this.
Admittedly, this could be achieved with a carefully constructed RegEx. However, in some circumstances it is cleaner to pass array. If the configs for each vhost are in a json file, it's nice to use an array. Much easier to read than a RegEx.
Eg: