Skip to content

Instantly share code, notes, and snippets.

@bjrmatos
Forked from robertklep/app.js
Created May 12, 2014 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjrmatos/905fea19d446c8496f9e to your computer and use it in GitHub Desktop.
Save bjrmatos/905fea19d446c8496f9e to your computer and use it in GitHub Desktop.
Express vhosting
var express = require('express');
var app = express();
var app2 = express();
app.use(express.vhost('app1.example.com', require('./app1').app));
app.use(express.vhost('app2.example.com', app2));
app2.get('/', function(req, res) {
res.send('app 2');
});
app.get('/', function(req, res) {
res.send('app');
});
app.listen(3012);
var express = require('express');
var app = express();
app.get('*', function(req, res) {
res.send('app 1');
});
exports.app = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment