mixdown-server
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -6,3 +6,3 @@ var _ = require('lodash'); | ||
var Worker = function(mixdown) { | ||
var Worker = function (mixdown) { | ||
this.vhosts = {}; | ||
@@ -21,3 +21,3 @@ this.mixdown = mixdown; | ||
//also i don't think it's necessary as mixdown will do this? | ||
mixdown.getExternalConfig(function(err, externalConfig) { | ||
mixdown.getExternalConfig(function (err, externalConfig) { | ||
if (err) { | ||
@@ -32,3 +32,3 @@ logger.error(err); | ||
externalConfig.on('update', function(services) { | ||
externalConfig.on('update', function (services) { | ||
var servs; | ||
@@ -38,6 +38,6 @@ var overlays; | ||
if (services && services.length) { | ||
overlays = _.filter(services, function(s) { | ||
overlays = _.filter(services, function (s) { | ||
return s.overlay === true; | ||
}); | ||
servs = _.reject(services, function(s) { | ||
servs = _.reject(services, function (s) { | ||
return s.overlay === true; | ||
@@ -53,3 +53,3 @@ }); | ||
mixdown.initServices(function(err) { | ||
mixdown.initServices(function (err) { | ||
if (err) { | ||
@@ -76,6 +76,6 @@ logger.error('Site refresh failed: ', err); | ||
Worker.prototype.getRouter = function(app) { | ||
Worker.prototype.getRouter = function (app) { | ||
var router = _.isFunction(app.router) ? app.router() : app.router.create(); | ||
router.on('error', function(err, httpContext) { | ||
router.on('error', function (err, httpContext) { | ||
var res = httpContext.response; | ||
@@ -86,6 +86,12 @@ res.statusCode = 500; | ||
router.on('not_found', function (err, httpContext) { | ||
var res = httpContext.response; | ||
res.statusCode = 404; | ||
res.end(err ? err.stack : null); | ||
}); | ||
return router; | ||
}; | ||
Worker.prototype.reload = function() { | ||
Worker.prototype.reload = function () { | ||
@@ -96,5 +102,5 @@ // Reset vhosts | ||
// Loop over cobrands and add all of the apps by hostnames. | ||
_.each(this.mixdown.apps, function(app) { | ||
_.each(this.mixdown.apps, function (app) { | ||
app.setup(function(err) { | ||
app.setup(function (err) { | ||
if (err) { | ||
@@ -106,3 +112,3 @@ logger.error(err); | ||
// map the vhost | ||
_.each(app._config.vhosts, function(host) { | ||
_.each(app._config.vhosts, function (host) { | ||
vhosts[host] = app; | ||
@@ -116,3 +122,3 @@ }); | ||
Worker.prototype.handleRequest = function(req, res) { | ||
Worker.prototype.handleRequest = function (req, res) { | ||
var app = null; | ||
@@ -140,3 +146,3 @@ var host = null; | ||
Worker.prototype.handleMessage = function(message, socket) { | ||
Worker.prototype.handleMessage = function (message, socket) { | ||
if (message === 'socket') { | ||
@@ -148,2 +154,2 @@ // call the http connection parsing stuff here. | ||
module.exports = Worker; | ||
module.exports = Worker; |
{ | ||
"name": "mixdown-server", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"main": "index", | ||
@@ -5,0 +5,0 @@ "description": "Simple server for activiting a site.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12332
354