Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-json-replay-server

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-json-replay-server - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

4

app_mock/example.html.json
{
"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;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc