Reputation: 574
I have the following code to setup two hosts on my local computer:
var express = require('express');
var app1 = express.createServer()
, app2 = express.createServer()
, main = express.createServer()
main.use(express.vhost('api.localhost:8000', app1)
.use(express.vhost('localhost:8000', app2))
When I navigate to each of those endpoints, I get 404'd. What's up with that?
Upvotes: 0
Views: 1162
Reputation: 39223
You should specify some routes on the respective servers. Something like:
app1.get('/', function(req, res, next) {
res.send("welcome to app1!");
});
app2.get('/', function(req, res, next) {
res.send("welcome to app2!");
});
Also, I don't think the port number is supposed to be part of the hostname
. Try with api.localhost
and localhost
, respectively.
Upvotes: 1