{"repo":"expressjs/vhost","free":true,"listed":false,"github":"https://github.com/expressjs/vhost","clone":"git clone https://github.com/expressjs/vhost.git","description":"virtual domain hosting","language":"JavaScript","stars":766,"topics":["javascript","nodejs","expressjs","vhost","middleware"],"license":"MIT","category":"dev-tools","readme_excerpt":"vhost [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Build Status][github-actions-ci-image]][github-actions-ci-url] [![Test Coverage][coveralls-image]][coveralls-url] Install API vhost(hostname, handle) Create a new middleware function to hand off request to handle when the incoming host for the request matches hostname . The function is called as handle(req, res, next) , like a standard middleware. hostname can be a string or a RegExp object. When hostname is a string it can contain to match 1 or more characters in that section of the hostname. When hostname is a RegExp, it will be forced to case-insensitive (since hostnames are) and will be forced to match based on the start and end of the hostname. When host is matched and the request is sent down to a vhost handler, the req.vhost property will be populated with an object. This object will have numeric properties corresponding to each wildcard (or capture group if RegExp object provided) and the hostname that was matched. Examples using with connect for static serving using with connect for user subdomains using with any generic request handler License MIT [npm-image]: https://img.shields.io/npm/v/vhost.svg [npm-url]: https://npmjs.org/package/vhost [coveralls-image]: https://img.shields.io/coveralls/expressjs/vhost/master.svg [coveralls-url]: https://coveralls.io/r/expressjs/vhost [downloads-image]: https://img.shields.io/npm/dm/vhost.svg [downloads-url]: https://npmjs.org/packa","default_branch":null,"files":null,"tree":[],"storefront":"/r/expressjs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/expressjs/vhost/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}