-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.js
More file actions
23 lines (18 loc) · 698 Bytes
/
boot.js
File metadata and controls
23 lines (18 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const express = require('express');
const http = require('http');
const vhost = require('vhost');
function createVirtualHost(domainName, dirPath) {
console.log(`>> Create VHOST for: ${domainName} -- ./${dirPath}/app`);
return vhost(domainName, require(`./${dirPath}/app`));
}
let app = express();
let dashboardHost = createVirtualHost('dash.example.com', 'dash');
let adminHost = createVirtualHost('admin.example.com', 'admin');
let appHost = createVirtualHost('prototype.example.com', 'proto');
app.use(dashboardHost);
app.use(adminHost);
app.use(appHost);
let port = 80;
app.listen(port, () => {
console.log(`Listening on port ${port} in ${app.settings.env} mode`);
});