-
-
Save bjrmatos/905fea19d446c8496f9e to your computer and use it in GitHub Desktop.
Express vhosting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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