JSPM

  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q49493F
  • License GPL-3.0

top-down virtual host

Package Exports

  • top-vhost

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (top-vhost) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

top-vhost

NPM version Linux Status Windows Status Dependency Status Coveralls

Top-Down virtual host for nodejs. Optional, you can set this module like a proxy or a redirect.

Installation

Install through NPM

npm install top-vhost

or

git clone git://github.com/hex7c0/top-vhost.git

API

inside expressjs project

var vhost = require('top-vhost');
var father = require('express')();
var child = require('express')();

child.get('/',function(req,res) {

  res.send('hello');
});

father.use(vhost({
  domain: 'foo.com',
  framework: child,
})).listen(3000);

vhost(options)

options

  • domain - String | RegExp Name or Regex of virtual host (required)
  • dynamic - String Path of dynamic configuration json file (only with Proxies). Array of hosts (default "disabled")
  • static - String Path of static configuration json file. Preserve options (default "disabled")
  • redirect - Array Array of url that will be redirected to this domain (default "disabled")
  • redirectStatus - Number Set type of HTTP header for redirect (permanently 301 or temporary 307) or use another (default "301")
  • insensitive - Boolean Set True if want parse insensitive match (default "sensitive")
  • stripWWW - Boolean Stripe all "www." url (default "disabled")
  • stripOnlyWWW - Boolean Redirect all "www." url to "." url (default "disabled")
  • stripHTTP - Boolean Redirect all "http://" to "https://" url (default "disabled")
  • stripHTTPS - Boolean Redirect all "https://" to "http://" url (default "disabled")
  • framework - Function Functions related to this virtual host (optional)
  • proxies - Object Object for build http proxy, related to http-proxy (optional)

related to https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy.js#L29-L52

Examples

Take a look at my examples

License GPLv3