{"_id":"vhost","_rev":"105-473b5be7644937e75536ecb352a4c423","name":"vhost","description":"virtual domain hosting","dist-tags":{"latest":"3.0.2"},"versions":{"0.0.1":{"name":"vhost","version":"0.0.1","author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"_id":"vhost@0.0.1","dist":{"shasum":"72342f812c586a08300070da44e6dd3929e7a091","tarball":"https://registry.npmjs.org/vhost/-/vhost-0.0.1.tgz","integrity":"sha512-iCU83ZYjWQ0Cm3z1bVSO77lsH7SyZHE4OpO/N4066bZPtmSfuSSR01BPsOFS0GCkby68JKLSrrrOqVMfQiJcyw==","signatures":[{"sig":"MEUCIGRUD10kx+CCJPS3hqf5JWfUoF9N7tMSPLQDDK6nhV2qAiEA3BOP5uAY8MpVC+lnigbEvsw0WJYMFUEOdYO1e+4v4IA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./vhost","files":[""],"engines":{"node":"*"},"repository":"git://gist.github.com/820042.git","_npmVersion":"0.2.17","description":"'connect's \"vhost\" middleware, modified to accept a generic handler function. Works well with \"stack\".","directories":{},"_nodeVersion":"v0.4.0-pre","_defaultsLoaded":true,"_engineSupported":true},"0.0.2":{"name":"vhost","version":"0.0.2","author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"_id":"vhost@0.0.2","homepage":"https://gist.github.com/820042","dist":{"shasum":"b7b0f78ca9c3fb1b99bd6ef70c54efe3fc803228","tarball":"https://registry.npmjs.org/vhost/-/vhost-0.0.2.tgz","integrity":"sha512-U/grX+JTVpZG7mosKNi9YUVs5jEc+cFsI3TdsUdbYFRi5HTXnFCFHGh1LN5UnRr/FL9JSslEaWnjGe8ccCTE4g==","signatures":[{"sig":"MEUCIQDpL6xOupZfvMHsXXljUkMABmq64S8DmNUI8icpmA/XeQIgTP2JsKzEcfxNLuSIYAIAUJO3MR12lu5emKcWa7K67Og=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./vhost.js","tags":["vhost","connect","stack","http","server"],"files":[""],"engines":{"node":"*"},"repository":{"url":"git://gist.github.com/820042.git","type":"git"},"_npmVersion":"0.3.17","description":"'connect's \"vhost\" middleware, modified to accept a generic handler function. Works well with \"stack\", \"connect\", and \"http\" servers.","directories":{},"_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"_engineSupported":true},"1.0.0":{"name":"vhost","version":"1.0.0","author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"vhost@1.0.0","maintainers":[{"name":"TooTallNate","email":"nathan@tootallnate.net"},{"name":"tootallnate","email":"nathan@tootallnate.net"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"dist":{"shasum":"654513f289a4f898aab745bbd633e40180c9c4c0","tarball":"https://registry.npmjs.org/vhost/-/vhost-1.0.0.tgz","integrity":"sha512-j5oZxSO2DUNZfdQBZlNrxLAGDg1BEgT7njN73f9XDldKoNzv00zeyhgUY5jR70G6kdTrF0xOzESQnnvaJ/Td4g==","signatures":[{"sig":"MEUCIQDQ67mRT6D9mqBBrE4uWHpJLqTC2xGgLaJZJGItbfwpSAIgU2zyAKDQGhxT2rQVYpvOv3GtYyfJuI/IH3S9ypemfJw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"test":"make test"},"_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"repository":{"url":"https://github.com/expressjs/vhost.git","type":"git"},"_npmVersion":"1.4.4","description":"virtual domain hosting","directories":{},"devDependencies":{"mocha":"^1.17.0","should":"^3.0.0","connect":"*","supertest":"*"}},"2.0.0":{"name":"vhost","version":"2.0.0","author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"vhost@2.0.0","maintainers":[{"name":"TooTallNate","email":"nathan@tootallnate.net"},{"name":"tootallnate","email":"nathan@tootallnate.net"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"shtylman","email":"shtylman@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"dist":{"shasum":"1e26770bd0fce86c40945591e6f284c6891791e2","tarball":"https://registry.npmjs.org/vhost/-/vhost-2.0.0.tgz","integrity":"sha512-TSExWM12MVtvIuBLMPyBuWBQLbHnmDZ3zfsoZwcUmKxzPX8l/cHKl5vVfbo8/KZ56UBAc/tTYXbaDGVDaIcrWw==","signatures":[{"sig":"MEYCIQCTEz334tYiyhrj8iKYP2NTjRn+XRtJBVPrlF4UTEJuiQIhAJEXXzAuhgZnm+rq3tCw9YrCV0pyYdURu/Qysd9Xa7L9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"1e26770bd0fce86c40945591e6f284c6891791e2","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha --reporter dot test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/"},"_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"repository":{"url":"git://github.com/expressjs/vhost","type":"git"},"_npmVersion":"1.4.9","description":"virtual domain hosting","directories":{},"devDependencies":{"mocha":"~1.20.1","should":"~4.0.1","istanbul":"0.2.10","supertest":"~0.13.0"}},"3.0.0":{"name":"vhost","version":"3.0.0","author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"vhost@3.0.0","maintainers":[{"name":"TooTallNate","email":"nathan@tootallnate.net"},{"name":"tootallnate","email":"nathan@tootallnate.net"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"shtylman","email":"shtylman@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"dist":{"shasum":"2d0ec59a3e012278b65adbe17c1717a5a5023045","tarball":"https://registry.npmjs.org/vhost/-/vhost-3.0.0.tgz","integrity":"sha512-XCMvvVU9Wptw62XM1uVGrcHR8y4yvVG9SNiwBgZ9V9aJOP7Snt06jE1j5mxIA33SuoSPxjcCXAja+f2BTSW9LQ==","signatures":[{"sig":"MEYCIQDLerbCUM+zlODjrmxAIkgbFlKfD4gWATn5O195CkNWBgIhAKw2VC4AlnnhAGQrsfNbsSgqRK3wJOLaBg526yJaAV2j","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","files":["LICENSE","HISTORY.md","index.js"],"_shasum":"2d0ec59a3e012278b65adbe17c1717a5a5023045","engines":{"node":">= 0.8.0"},"gitHead":"ca444a5351d7e499b8e2b5056163573cd6e671a1","scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"repository":{"url":"https://github.com/expressjs/vhost","type":"git"},"_npmVersion":"1.4.21","description":"virtual domain hosting","directories":{},"devDependencies":{"mocha":"~1.21.4","should":"~4.0.1","istanbul":"0.3.0","supertest":"~0.13.0"}},"3.0.1":{"name":"vhost","version":"3.0.1","author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"vhost@3.0.1","maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"},{"name":"TooTallNate","email":"nathan@tootallnate.net"}],"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"dist":{"shasum":"835598d967ab7bae2a913a873ad07ca8e9dc0ebb","tarball":"https://registry.npmjs.org/vhost/-/vhost-3.0.1.tgz","integrity":"sha512-DwBVVDnqU/aCNZTxftVx8pYOtlDYHiNDCK9zANAsptpK+BJz8HRlzN4yhYraEvE8gTS+S7vfOSIizvUqqBJIPw==","signatures":[{"sig":"MEQCIBpH2LY9cyZjBv+oNhnVfQdKkFbdqyC6f27WC/iesvDYAiBhvgF/iHimQ2izJPp8qHuv0Gp369Ur8SJTN762HYsfbA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","files":["LICENSE","HISTORY.md","index.js"],"_shasum":"835598d967ab7bae2a913a873ad07ca8e9dc0ebb","engines":{"node":">= 0.8.0"},"gitHead":"10c5a25453c5099390deea55e068a6f51d08acbc","scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"repository":{"url":"https://github.com/expressjs/vhost","type":"git"},"_npmVersion":"1.4.28","description":"virtual domain hosting","directories":{},"devDependencies":{"mocha":"2.2.5","istanbul":"0.3.17","supertest":"1.0.1"}},"3.0.2":{"name":"vhost","version":"3.0.2","license":"MIT","_id":"vhost@3.0.2","maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"},{"name":"TooTallNate","email":"nathan@tootallnate.net"}],"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"}],"homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"dist":{"shasum":"2fb1decd4c466aa88b0f9341af33dc1aff2478d5","tarball":"https://registry.npmjs.org/vhost/-/vhost-3.0.2.tgz","integrity":"sha512-S3pJdWrpFWrKMboRU4dLYgMrTgoPALsmYwOvyebK2M6X95b9kQrjZy5rwl3uzzpfpENe/XrNYu/2U+e7/bmT5g==","signatures":[{"sig":"MEUCIQCEhVhVvKJk0eSQPHVhLv5UH3+ntpBjaqbL73SLO7IPfAIgMgaRzVwvkRGCtNWvxdtxQQcxn7qBPi14NRwuUlPc4n4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","files":["LICENSE","HISTORY.md","index.js"],"_shasum":"2fb1decd4c466aa88b0f9341af33dc1aff2478d5","engines":{"node":">= 0.8.0"},"gitHead":"2dff3f358265380328067d1ffc91e342b665f586","scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"repository":{"url":"https://github.com/expressjs/vhost","type":"git"},"_npmVersion":"1.4.28","description":"virtual domain hosting","directories":{},"devDependencies":{"mocha":"2.3.3","istanbul":"0.3.22","supertest":"1.1.0"}}},"time":{"created":"2011-02-10T06:39:20.081Z","modified":"2024-05-30T18:12:52.556Z","0.0.1":"2011-02-10T06:39:20.444Z","0.0.2":"2011-04-03T18:35:27.843Z","1.0.0":"2014-03-05T06:31:25.659Z","2.0.0":"2014-06-09T02:49:35.269Z","3.0.0":"2014-08-30T06:26:04.628Z","3.0.1":"2015-07-20T02:14:44.416Z","3.0.2":"2015-10-13T04:29:07.674Z"},"maintainers":[{"email":"ulisesgascondev@gmail.com","name":"ulisesgascon"},{"email":"jonathanrichardong@gmail.com","name":"jongleberry"},{"email":"doug@somethingdoug.com","name":"dougwilson"},{"email":"nathan@tootallnate.net","name":"TooTallNate"},{"email":"fishrock123@rocketmail.com","name":"fishrock123"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"},{"email":"ljharb@gmail.com","name":"ljharb"}],"repository":{"url":"https://github.com/expressjs/vhost","type":"git"},"license":"MIT","homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"readme":"# vhost\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n[![Gratipay][gratipay-image]][gratipay-url]\n\n## Install\n\n```sh\n$ npm install vhost\n```\n\n## API\n\n```js\nvar vhost = require('vhost')\n```\n\n### vhost(hostname, handle)\n\nCreate a new middleware function to hand off request to `handle` when the incoming\nhost for the request matches `hostname`. The function is called as\n`handle(req, res, next)`, like a standard middleware.\n\n`hostname` can be a string or a RegExp object. When `hostname` is a string it can\ncontain `*` to match 1 or more characters in that section of the hostname. When\n`hostname` is a RegExp, it will be forced to case-insensitive (since hostnames are)\nand will be forced to match based on the start and end of the hostname.\n\nWhen host is matched and the request is sent down to a vhost handler, the `req.vhost`\nproperty will be populated with an object. This object will have numeric properties\ncorresponding to each wildcard (or capture group if RegExp object provided) and the\n`hostname` that was matched.\n\n```js\n// for match of \"foo.bar.example.com:8080\" against \"*.*.example.com\":\nreq.vhost.host === 'foo.bar.example.com:8080'\nreq.vhost.hostname === 'foo.bar.example.com'\nreq.vhost.length === 2\nreq.vhost[0] === 'foo'\nreq.vhost[1] === 'bar'\n```\n\n## Examples\n\n### using with connect for static serving\n\n```js\nvar connect = require('connect')\nvar serveStatic = require('serve-static')\nvar vhost = require('vhost')\n\nvar mailapp = connect()\n\n// add middlewares to mailapp for mail.example.com\n\n// create app to serve static files on subdomain\nvar staticapp = connect()\nstaticapp.use(serveStatic('public'))\n\n// create main app\nvar app = connect()\n\n// add vhost routing to main app for mail\napp.use(vhost('mail.example.com', mailapp))\n\n// route static assets for \"assets-*\" subdomain to get\n// around max host connections limit on browsers\napp.use(vhost('assets-*.example.com', staticapp))\n\n// add middlewares and main usage to app\n\napp.listen(3000)\n```\n\n### using with connect for user subdomains\n\n```js\nvar connect = require('connect')\nvar serveStatic = require('serve-static')\nvar vhost = require('vhost')\n\nvar mainapp = connect()\n\n// add middlewares to mainapp for the main web site\n\n// create app that will server user content from public/{username}/\nvar userapp = connect()\n\nuserapp.use(function(req, res, next){\n  var username = req.vhost[0] // username is the \"*\"\n\n  // pretend request was for /{username}/* for file serving\n  req.originalUrl = req.url\n  req.url = '/' + username + req.url\n\n  next()\n})\nuserapp.use(serveStatic('public'))\n\n// create main app\nvar app = connect()\n\n// add vhost routing for main app\napp.use(vhost('userpages.local', mainapp))\napp.use(vhost('www.userpages.local', mainapp))\n\n// listen on all subdomains for user pages\napp.use(vhost('*.userpages.local', userapp))\n\napp.listen(3000)\n```\n\n### using with any generic request handler\n\n```js\nvar connect = require('connect')\nvar http = require('http')\nvar vhost = require('vhost')\n\n// create main app\nvar app = connect()\n\napp.use(vhost('mail.example.com', function (req, res) {\n  // handle req + res belonging to mail.example.com\n  res.setHeader('Content-Type', 'text/plain')\n  res.end('hello from mail!')\n}))\n\n// an external api server in any framework\nvar httpServer = http.createServer(function (req, res) {\n  res.setHeader('Content-Type', 'text/plain')\n  res.end('hello from the api!')\n})\n\napp.use(vhost('api.example.com', function (req, res) {\n  // handle req + res belonging to api.example.com\n  // pass the request to a standard Node.js HTTP server\n  httpServer.emit('request', req, res)\n}))\n\napp.listen(3000)\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/vhost.svg\n[npm-url]: https://npmjs.org/package/vhost\n[travis-image]: https://img.shields.io/travis/expressjs/vhost/master.svg\n[travis-url]: https://travis-ci.org/expressjs/vhost\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/vhost/master.svg\n[coveralls-url]: https://coveralls.io/r/expressjs/vhost\n[downloads-image]: https://img.shields.io/npm/dm/vhost.svg\n[downloads-url]: https://npmjs.org/package/vhost\n[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg\n[gratipay-url]: https://gratipay.com/dougwilson/\n","readmeFilename":"README.md","users":{"isik":true,"bengi":true,"clunt":true,"demod":true,"etsit":true,"jps78":true,"stany":true,"aseman":true,"devgar":true,"dj2bee":true,"merkjs":true,"monjer":true,"nuwaio":true,"zhoutk":true,"flyslow":true,"holyzfy":true,"juanf03":true,"noderat":true,"bapinney":true,"gejiawen":true,"kistoryg":true,"sarnsdev":true,"sekwah41":true,"wkaifang":true,"yash3492":true,"zeusdeux":true,"zuojiang":true,"dberseron":true,"joaocosta":true,"landy2014":true,"morphesus":true,"tjfwalker":true,"aquiandres":true,"giussa_dan":true,"mofanjunoo":true,"quocnguyen":true,"rocket0191":true,"sammok2003":true,"yaphtes.ks":true,"yasinaydin":true,"wangnan0610":true,"mobeicaoyuan":true,"nickeltobias":true,"tobiasnickel":true,"chinawolf_wyp":true,"markthethomas":true,"mdedirudianto":true,"program247365":true,"scottfreecode":true,"jonniespratley":true,"matteospampani":true,"hyokosdeveloper":true},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"}]}