0

I found and answer here How should I organize multiple Express servers on the same system? and the best answer was this

express.createServer()
.use(express.vhost('hostname1.com', require('/path/to/hostname1').app)
.use(express.vhost('hostname2.com', require('/path/to/hostname2').app)
.listen(3000)

All ok before there, but how I should organize to handle the request of each site (app) ie myfirstdomain.com => myhost:3000 (=> means proxy) and myseconddomain.com => myhost:3000, well my real question its how I determine which request handles which app, since all request ie / have both of them in their routes.

This its the first app

var app = express.createServer();

app.get('/', function(req, res){
    res.send('my first domain');
});

Then this its the second app

var app = express.createServer();

app.get('/', function(req, res){
    res.send('my second domain');
});
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
norman784
  • 2,201
  • 3
  • 24
  • 31

1 Answers1

0

I was not read well the code example there, the first param its the domain that will execute the app. I feel so fool!

norman784
  • 2,201
  • 3
  • 24
  • 31