@allegiant/core
Advanced tools
Comparing version 0.0.8 to 0.0.9
36
index.js
@@ -79,6 +79,11 @@ /* | ||
redirect(uri, status=302) { | ||
this.setHeader('location', uri); | ||
return status; | ||
} | ||
// leaving intact for now, though it's not needed | ||
end(content) { | ||
if (!this.fin) { | ||
console.log("@@@@@ ENDED BEFORE FIN: " + this.fname); // eslint-disable-line | ||
if (this.debug) console.log("@@@@@ ENDED BEFORE FIN: " + this.fname); // eslint-disable-line | ||
} | ||
@@ -91,3 +96,3 @@ | ||
return new Promise((resolve) => { | ||
readable.on('errror', async function() { | ||
readable.on('error', async function() { | ||
return resolve(false); | ||
@@ -126,3 +131,3 @@ }.bind(this)) | ||
constructor(host, port, options={}) { | ||
const filteredOptions = ['secure','certs'], | ||
const filteredOptions = [ 'debug','secure','certs' ], | ||
defaultModules = [ ['@allegiant/static', expect(options.static, true) ] ]; | ||
@@ -141,7 +146,8 @@ | ||
this.debug = typeof options.debug === 'boolean' ? options.debug : false; | ||
this.host = host; | ||
this.port = port; | ||
this.router = new Router(); | ||
this.host = host; | ||
this.port = port; | ||
// limit post data, stops flood, nuke, like attacks and bad client requests | ||
@@ -200,3 +206,3 @@ this.postDataLimit = expect(options.postDataLimit, 1e6); // 1e6 = 1,000,000 | ||
if (this.moduleLoaded(module)) { | ||
console.log(":: Module Already Loaded: ", module); // eslint-disable-line | ||
if (this.debug) console.log(":: Module Already Loaded: ", module); // eslint-disable-line | ||
return; | ||
@@ -218,3 +224,3 @@ } | ||
if (typeof this.modules[name].bind === 'function') { | ||
console.log("Binding Module: ", name); // eslint-disable-line | ||
if (this.debug) console.log("Binding Module: ", name); // eslint-disable-line | ||
this.modules[name].bind(this); | ||
@@ -257,6 +263,6 @@ } | ||
} | ||
this._finalize(conn, true); | ||
} | ||
this._finalize(conn, true); | ||
} | ||
get(uri, handler=false) { | ||
@@ -289,3 +295,3 @@ this.router._addScan('GET', uri, handler); | ||
} else { | ||
console.log("WARNING: CONNECTION ALREADY ENDED: ", conn.uri); // eslint-disable-line | ||
if (this.debug) console.log("WARNING: CONNECTION ALREADY ENDED: ", conn.uri); // eslint-disable-line | ||
} | ||
@@ -298,3 +304,2 @@ | ||
this.server.listen(this.port, this.host); | ||
//console.log("Routes: ", util.inspect(this.router.getRoutes(), { depth: 5 })); | ||
} | ||
@@ -317,3 +322,2 @@ | ||
handlers = options ? this.ev[event][options] : []; | ||
//handlers = Array.prototype.concat.apply([], options.map(key => this.ev[event][key])); | ||
break; | ||
@@ -336,3 +340,3 @@ default: | ||
case 'end': | ||
console.log(":: Binding App Event: " + event); // eslint-disable-line | ||
if (this.debug) console.log(":: Binding App Event: " + event); // eslint-disable-line | ||
if (this.ev[event].indexOf(cb) == -1) | ||
@@ -346,3 +350,3 @@ this.ev[event].push(cb); | ||
case 'any': | ||
console.log(":: Binding App Event: " + event + ": ", option); // eslint-disable-line | ||
if (this.debug) console.log(":: Binding App Event: " + event + ": ", option); // eslint-disable-line | ||
if (this.ev[event][option].indexOf(cb) == -1) | ||
@@ -349,0 +353,0 @@ this.ev[event][option].push(cb); |
{ | ||
"name": "@allegiant/core", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Small modular, effective app framework", | ||
@@ -36,3 +36,3 @@ "author": "echopoint <echopoint@tutanota.com>", | ||
"@allegiant/httpduplex": "^0.3.6", | ||
"@allegiant/static": "0.0.6" | ||
"@allegiant/static": "0.0.7" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
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
586
27991
10
+ Added@allegiant/static@0.0.7(transitive)
- Removed@allegiant/static@0.0.6(transitive)
Updated@allegiant/static@0.0.7