yukon
Advanced tools
Comparing version 0.0.13 to 0.0.14
12
index.js
@@ -35,11 +35,8 @@ var _ = require('lodash'); | ||
var defaultConfig = { | ||
// called at the start of every api or stub call | ||
beforeApiCall: null, | ||
// called at the start of every api call | ||
apiCallBefore: null, | ||
// called after every api call | ||
afterApiCall: null, | ||
apiCallback: null, | ||
// called after every stub call | ||
afterStubCall: null, | ||
// default debug function | ||
@@ -110,2 +107,5 @@ yukonCustomDebug: function(identifier) { | ||
// custom headers to sent to API | ||
customHeaders: [], | ||
// (numeric) - max API return time in ms | ||
@@ -112,0 +112,0 @@ timeout: null, |
@@ -6,2 +6,3 @@ // custom middleware invoked by doAPI (not express middleware) | ||
var sa = require('superagent'); | ||
var fs = require('fs'); | ||
var _ = require('lodash'); | ||
@@ -34,3 +35,3 @@ | ||
config.beforeApiCall(callArgs, req, res); | ||
config.apiCallBefore(callArgs, req, res); | ||
@@ -62,4 +63,4 @@ if (callArgs.host) callArgs.path = callArgs.host + callArgs.path; | ||
if (config.afterApiCall) | ||
config.afterApiCall(callArgs, req, res, next); | ||
if (config.apiCallback) | ||
config.apiCallback(callArgs, req, res, next); | ||
else | ||
@@ -87,11 +88,12 @@ next(err); | ||
catch(e) { | ||
debug('stub not found!'); | ||
next(); | ||
next(new Error(debug('stub not found!'))); | ||
return; | ||
} | ||
callArgs.apiResponse = {statusCode: 'STUB', req: {path: 'STUB: '+stubName}}; | ||
res.locals[callArgs.namespace] = JSON.parse(data); | ||
if (config.afterStubCall) | ||
config.afterStubCall(callArgs, req, res, next); | ||
if (config.apiCallback) | ||
config.apiCallback(callArgs, req, res, next); | ||
else | ||
@@ -98,0 +100,0 @@ next(); |
{ | ||
"name": "yukon", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Self-discovering component-based API-driven framework based on express", | ||
@@ -25,5 +25,12 @@ "main": "index.js", | ||
"lodash": "^2.4.1", | ||
"nodulejs": "^1.1.9", | ||
"nodulejs": "^1.1.11", | ||
"superagent": "^0.21.0" | ||
}, | ||
"devDependencies": { | ||
"body-parser": "^1.10.1", | ||
"express": "^4.10.6", | ||
"jade": "^1.8.2", | ||
"mocha": "^2.1.0", | ||
"supertest": "^0.15.0" | ||
}, | ||
"readme": "yukon\n=====\n\nNode component discovery and initialization interface\n", | ||
@@ -30,0 +37,0 @@ "readmeFilename": "README.md", |
@@ -1,2 +0,2 @@ | ||
yukon | ||
yukon API framework | ||
===== | ||
@@ -3,0 +3,0 @@ |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
23886
5
11
247
1
Updatednodulejs@^1.1.11