I use vhostexpress / connect middleware , and I'm a little confused about how to use it. I want one set of routes to apply to hosts with subdomains, and another set to apply to hosts without subdomains.
In my app.js file I have
var app = express.createServer();
app.use...(middlware)...
app.use(express.vhost('*.host', require('./domain_routing')("yes")));
app.use(express.vhost('host', require('./domain_routing')("no")));
app.use...(middlware)...
app.listen(8000);
and then to domain_routing.js:
module.exports = function(subdomain){
var app = express.createServer();
require('./routes')(app, subdomain);
return app;
}
and then in routes.jsI plan to run route sets, depending on whether the subdomain variable passed "yes"or "no".
, ? , app ( , , - ). app ?