Example #1
0
app.configure("production", function() {
    console.log("Using production settings.");
    app.use(express.logger("tiny"));
    // AWS configuration and AWS-related settings.
    AWS.config.update({region: 'us-east-1'});
    // Subdomains for the API and the management application.
    app.use(express.vhost("api.adcrafted.com", api.app));
    app.use(express.vhost("manage.adcrafted.com", manage.app));
});
Example #2
0
app.configure("development", function() {
    console.log("Using development settings.");
    app.use(express.logger("dev"));
    // AWS configuration and AWS-related settings.
    AWS.config.update({region: 'us-east-1'});
    // Subdomains for the API and the management application.
    app.use(express.vhost("api.citreo.us", api.app));
    app.use(express.vhost("manage.citreo.us", manage.app));
});
Example #3
0
app.configure("local", function() {
    console.log("Using local settings for Default Application.");
    app.use(express.logger("dev"));
    // AWS configuration and AWS-related settings.
    AWS.config.loadFromPath("./.local/credentials.json");
    // Subdomains for the API and the management application.
    app.use(express.vhost("api.test.com", api.app));
    app.use(express.vhost("manage.test.com", manage.app));
});
Example #4
0
function add_app(name, info, use_vhost) {
  var app = require(info)();
  if (use_vhost)
    server.app.use(express.vhost(name, app));
  else
    server.cms.use(app);
}
Example #5
0
function add_cms(name, info, use_vhost) {
  var cms = new current.Cms(require(info));
  if (use_vhost)
    server.cms.use(express.vhost(name, cms.app));
  else
    server.cms.use(cms.app);
}
Example #6
0
Application.prototype._createVhostAlias = function (domain, alias, app) {
  var config = this.config;

  if (arguments.length === 2) {
    app = alias;
    alias = domain;
  }

  if (typeof alias === 'undefined') {
    alias = domain;
  } else if (alias !== domain) {
    alias += '|' + domain;
  }

  app.use(function (req, res, next) {
    if (req.host !== domain) {
      var port = config.get('port');

      res.redirect(301, 'http://' + domain + (port === 80 ? '' : (':' + port)) + req.originalUrl);
    } else {
      next();
    }
  });

  return express.vhost(alias, app);
};
 var mkRedirect = function(domain, url){
   app.use(express.vhost(domain, function(req, res){
     req.handled = true;
     res.writeHead(301, {"Location": url});
     res.end();
   }));
 }