Socket
Book a DemoInstallSign in
Socket

multihost

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multihost

Hosting multiple Express apps on the same server.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

multihost build status Coverage Status

NPM

Hosting multiple Express apps on the same server.

Installation

$ npm install --save multihost

API

var multihost = require('multihost')

multihost(options)

Returns a middleware to host an Express application.

Options

The function takes an option options object that may contain any of the following keys:

hosts

A virtual host string or an array of virtual host strings.

route

A route string containing the URI to be matched.

server

An Express app as shown below:

var app = express();

Example

var app = express();
var fooApp = express();
var barApp = express();
var mainApp = express();
var multihost = require('multihost');

app.use(multihost({
    hosts: 'foo.com',
    server: fooApp
}));

app.use(multihost({
    hosts: 'bar.com',
    server: barApp
}));

app.use(multihost({
    hosts: '*.com',
    route: '/foo',
    server: fooApp
}));

app.use(multihost({
    hosts: '*.com',
    route: '/bar',
    server: barApp
}));

app.use(multihost({
    hosts: [
        '*.com',
        'localhost'
    ],
    server: mainApp
}));

License

MIT

Keywords

connect

FAQs

Package last updated on 17 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts