{"_id":"vhost","_rev":"71034","name":"vhost","description":"virtual domain hosting","dist-tags":{"latest":"3.0.2"},"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"time":{"modified":"2021-06-03T10:23:25.000Z","created":"2011-02-10T06:39:20.444Z","3.0.2":"2015-10-13T04:29:07.674Z","3.0.1":"2015-07-20T02:14:44.416Z","3.0.0":"2014-08-30T06:26:04.628Z","2.0.0":"2014-06-09T02:49:35.269Z","1.0.0":"2014-03-05T06:31:25.659Z","0.0.2":"2011-04-03T18:35:27.843Z","0.0.1":"2011-02-10T06:39:20.444Z"},"users":{"matteospampani":true,"tjfwalker":true,"clunt":true,"joaocosta":true,"flyslow":true,"program247365":true,"dongxu":true,"holyzfy":true,"morphesus":true,"zeusdeux":true,"etsit":true,"kparkov":true,"yasinaydin":true,"aquiandres":true,"markthethomas":true,"zhoutk":true,"yash3492":true,"stany":true,"dj2bee":true,"tobiasnickel":true,"sammok2003":true,"bapinney":true,"wangnan0610":true,"nickeltobias":true,"gejiawen":true,"monjer":true,"demod":true,"wkaifang":true,"chrisx":true,"hyokosdeveloper":true,"mobeicaoyuan":true,"sekwah41":true,"kistoryg":true,"aseman":true,"scottfreecode":true,"isik":true,"noderat":true,"yaphtes.ks":true,"landy2014":true,"giussa_dan":true,"quocnguyen":true,"juanf03":true,"mofanjunoo":true,"bengi":true,"merkjs":true,"rocket0191":true,"chinawolf_wyp":true,"devgar":true,"majkel":true,"sarnsdev":true,"nuwaio":true,"jonniespratley":true,"zuojiang":true,"mdedirudianto":true,"dberseron":true,"jps78":true},"repository":{"type":"git","url":"https://github.com/expressjs/vhost"},"versions":{"3.0.2":{"name":"vhost","description":"virtual domain hosting","version":"3.0.2","contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/expressjs/vhost"},"devDependencies":{"istanbul":"0.3.22","mocha":"2.3.3","supertest":"1.1.0"},"files":["LICENSE","HISTORY.md","index.js"],"engines":{"node":">= 0.8.0"},"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/"},"gitHead":"2dff3f358265380328067d1ffc91e342b665f586","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"homepage":"https://github.com/expressjs/vhost","_id":"vhost@3.0.2","_shasum":"2fb1decd4c466aa88b0f9341af33dc1aff2478d5","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"2fb1decd4c466aa88b0f9341af33dc1aff2478d5","size":3956,"noattachment":false,"key":"/vhost/-/vhost-3.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-3.0.2.tgz"},"directories":{},"publish_time":1444710547674,"_cnpm_publish_time":1444710547674,"_hasShrinkwrap":false},"3.0.1":{"name":"vhost","description":"virtual domain hosting","version":"3.0.1","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/expressjs/vhost"},"devDependencies":{"istanbul":"0.3.17","mocha":"2.2.5","supertest":"1.0.1"},"files":["LICENSE","HISTORY.md","index.js"],"engines":{"node":">= 0.8.0"},"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/"},"gitHead":"10c5a25453c5099390deea55e068a6f51d08acbc","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"homepage":"https://github.com/expressjs/vhost","_id":"vhost@3.0.1","_shasum":"835598d967ab7bae2a913a873ad07ca8e9dc0ebb","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"835598d967ab7bae2a913a873ad07ca8e9dc0ebb","size":3882,"noattachment":false,"key":"/vhost/-/vhost-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-3.0.1.tgz"},"directories":{},"publish_time":1437358484416,"_cnpm_publish_time":1437358484416,"_hasShrinkwrap":false},"3.0.0":{"name":"vhost","description":"virtual domain hosting","version":"3.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/expressjs/vhost"},"devDependencies":{"istanbul":"0.3.0","mocha":"~1.21.4","should":"~4.0.1","supertest":"~0.13.0"},"files":["LICENSE","HISTORY.md","index.js"],"engines":{"node":">= 0.8.0"},"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/"},"gitHead":"ca444a5351d7e499b8e2b5056163573cd6e671a1","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"homepage":"https://github.com/expressjs/vhost","_id":"vhost@3.0.0","_shasum":"2d0ec59a3e012278b65adbe17c1717a5a5023045","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"2d0ec59a3e012278b65adbe17c1717a5a5023045","size":3632,"noattachment":false,"key":"/vhost/-/vhost-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-3.0.0.tgz"},"directories":{},"publish_time":1409379964628,"_cnpm_publish_time":1409379964628,"_hasShrinkwrap":false},"2.0.0":{"name":"vhost","description":"virtual domain hosting","version":"2.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"git://github.com/expressjs/vhost"},"devDependencies":{"istanbul":"0.2.10","mocha":"~1.20.1","should":"~4.0.1","supertest":"~0.13.0"},"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/"},"bugs":{"url":"https://github.com/expressjs/vhost/issues"},"homepage":"https://github.com/expressjs/vhost","_id":"vhost@2.0.0","_shasum":"1e26770bd0fce86c40945591e6f284c6891791e2","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"1e26770bd0fce86c40945591e6f284c6891791e2","size":3804,"noattachment":false,"key":"/vhost/-/vhost-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-2.0.0.tgz"},"directories":{},"publish_time":1402282175269,"_cnpm_publish_time":1402282175269,"_hasShrinkwrap":false},"1.0.0":{"name":"vhost","description":"virtual domain hosting","version":"1.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/expressjs/vhost.git"},"bugs":{"url":"https://github.com/expressjs/vhost/issues"},"devDependencies":{"mocha":"^1.17.0","should":"^3.0.0","supertest":"*","connect":"*"},"scripts":{"test":"make test"},"homepage":"https://github.com/expressjs/vhost","_id":"vhost@1.0.0","dist":{"shasum":"654513f289a4f898aab745bbd633e40180c9c4c0","size":1929,"noattachment":false,"key":"/vhost/-/vhost-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-1.0.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"directories":{},"publish_time":1394001085659,"_hasShrinkwrap":false,"_cnpm_publish_time":1394001085659},"0.0.2":{"name":"vhost","description":"'connect's \"vhost\" middleware, modified to accept a generic handler function. Works well with \"stack\", \"connect\", and \"http\" servers.","tags":["vhost","connect","stack","http","server"],"version":"0.0.2","repository":{"type":"git","url":"git://gist.github.com/820042.git"},"homepage":"https://gist.github.com/820042","author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"main":"./vhost.js","engines":{"node":"*"},"directories":{},"files":[""],"_id":"vhost@0.0.2","_engineSupported":true,"_npmVersion":"0.3.17","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"b7b0f78ca9c3fb1b99bd6ef70c54efe3fc803228","size":1133,"noattachment":false,"key":"/vhost/-/vhost-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-0.0.2.tgz"},"publish_time":1301855727843,"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1301855727843},"0.0.1":{"name":"vhost","description":"'connect's \"vhost\" middleware, modified to accept a generic handler function. Works well with \"stack\".","version":"0.0.1","repository":"git://gist.github.com/820042.git","author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"main":"./vhost","engines":{"node":"*"},"_id":"vhost@0.0.1","_engineSupported":true,"_npmVersion":"0.2.17","_nodeVersion":"v0.4.0-pre","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"72342f812c586a08300070da44e6dd3929e7a091","size":714,"noattachment":false,"key":"/vhost/-/vhost-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/vhost/download/vhost-0.0.1.tgz"},"publish_time":1297319960444,"maintainers":[{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1297319960444}},"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","_attachments":{},"homepage":"https://github.com/expressjs/vhost","bugs":{"url":"https://github.com/expressjs/vhost/issues"},"license":"MIT"}