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.0.7 to 0.0.8

src/watcher.js

2

app_mock/example.2.json

@@ -8,5 +8,5 @@ {

"data" : {
"message" : "you got it!"
"message" : "you got it! aaaa"
}
}
}
{
"name": "simple-json-replay-server",
"version": "0.0.7",
"version": "0.0.8",
"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.",
"main": "main.js",
"scripts": {
"start": "node src/main.js",
"test": "mocha"
},
"engines" :{
"node" : ">=4.0.0"
"engines": {
"node": ">=4.0.0"
},

@@ -34,7 +35,9 @@ "keywords": [

"glob": "^7.1.1",
"underscore": "^1.8.3"
"underscore": "^1.8.3",
"chokidar": "^1.6.1"
},
"devDependencies": {
"mocha": "^3.2.0"
"mocha": "^3.2.0",
"rx": "^4.1.0"
}
}

@@ -1,2 +0,3 @@

# Simple JSON Replay Server ❤️ [![Build Status](https://travis-ci.org/realdah/simple-json-replay-server.svg?branch=master)](https://travis-ci.org/realdah/simple-json-replay-server) [![npm version](https://badge.fury.io/js/simple-json-replay-server.svg)](https://badge.fury.io/js/simple-json-replay-server)
# Simple JSON Replay Server ❤️ [![Build Status](https://travis-ci.org/realdah/simple-json-replay-server.svg?branch=master)](https://travis-ci.org/realdah/simple-json-replay-server) [![npm version](https://badge.fury.io/js/simple-json-replay-server.svg)](https://badge.fury.io/js/simple-json-replay-server) [![Node version](https://img.shields.io/node/v/simple-json-replay-server.svg?style=flat)](http://nodejs.org/download/)
Pefect companion with single page application development, and unit mock testing. Especially designed for angularjs 1 and 2 & reactjs.

@@ -3,0 +4,0 @@

@@ -8,3 +8,3 @@ var express = require('express');

var match = require("./match");
var watcher = require('./watcher');
var app = express();

@@ -21,5 +21,7 @@

var requestMappings = mockDataLoader.loadRequestMappings(options.folder);
mockDataLoader.loadRequestMappings(options.folder);
app.all('*', function (req, res) {
var requestMappings = mockDataLoader.getRequestMappings();
var mockDataConfig = match.matchRequests(req, requestMappings);

@@ -58,1 +60,3 @@

//start watching the changes.
watcher.startWatching(options.folder);

@@ -32,20 +32,2 @@ var _ = require('underscore');

//check query
// _.each(query,function(value, key){
// if(!mockDataConfig.request.query) {
// //if not defined query object, ignore
// return;
// }
// var configValue = mockDataConfig.request.query[key];
// if(configValue != undefined ) { //if key exists
// if(configValue == value) {
// score += 1000;
// } else {
// score = NOT_MATCH;
// }
// }
// });
_.each(mockDataConfig.request.query,function(value, key){

@@ -64,12 +46,2 @@

// //check headers
// _.each(mockDataConfig.request.headers,function(value, key){
// if(headers[key] == value) {
// score += 100;
// } else {
// score = NOT_MATCH;
// return;
// }
// });
if(score >= bestScore) {

@@ -76,0 +48,0 @@ bestScore = score;

@@ -76,2 +76,1 @@ var glob = require("glob"); //load many files and filtering with some rules at one shot

exports.loadRequestMappings = loadRequestMappings;
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