simple-json-replay-server
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"request" : { | ||
"path": "html", | ||
"method": "get" | ||
"method": "get"' | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"html" : "<html><body><h1>Hello world.</h1><p>You can see this message is in html format instead of json format</p></body></html>" | ||
"html": "<html><body><h1>Hello world.</h1><p>You can see this message is in html format instead of json format</p></body></html>" | ||
} | ||
} |
{ | ||
"name": "simple-json-replay-server", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A simple json replay server which can be used for standalone frontend web application (angular especially) when development. Simply put the url & parameters & response json data, then hit the url in browser or from your web application, whenever it matches the url and parameters, it will return the best match json data.", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -37,10 +37,18 @@ var glob = require("glob"); //load many files and filtering with some rules at one shot | ||
var successLoaded = _.size(files); | ||
_.each(files, function (filePath) { | ||
util.print(filePath); | ||
var mockDataConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')); | ||
mockDataConfig.filePath = filePath; | ||
buildMappings(mockDataConfig); | ||
try { | ||
var mockDataConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')); | ||
mockDataConfig.filePath = filePath; | ||
buildMappings(mockDataConfig); | ||
} catch(e) { | ||
successLoaded--; | ||
util.warning(filePath + ' - failed: ' + e.message); | ||
} | ||
util.print(filePath + ' - loaded'); | ||
}); | ||
util.print(_.size(files) + " json mock data files are found and loaded successfully."); | ||
util.print(successLoaded + " json mock data files are found and loaded successfully."); | ||
}); | ||
@@ -47,0 +55,0 @@ |
@@ -12,2 +12,7 @@ var _ = require('underscore'); | ||
function warning(message) { | ||
message = '\x1b[33m' + message + '\x1b[0m'; | ||
print(message); | ||
} | ||
function printVersion() { | ||
@@ -54,1 +59,2 @@ var pjson = require('../package.json'); | ||
exports.print = print; | ||
exports.warning = warning; |
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
58113
848