simple-json-replay-server
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -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; | ||
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
24539
15
390
217
4
2
+ Addedchokidar@^1.6.1
+ Addedanymatch@1.3.2(transitive)
+ Addedarr-diff@2.0.04.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedarray-unique@0.2.10.3.2(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedasync-each@1.0.6(transitive)
+ Addedatob@2.1.2(transitive)
+ Addedbase@0.11.2(transitive)
+ Addedbinary-extensions@1.13.1(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbraces@1.8.52.3.2(transitive)
+ Addedcache-base@1.0.1(transitive)
+ Addedchokidar@1.7.0(transitive)
+ Addedclass-utils@0.3.6(transitive)
+ Addedcollection-visit@1.0.0(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddefine-property@0.2.51.0.02.0.2(transitive)
+ Addedexpand-brackets@0.1.52.1.4(transitive)
+ Addedexpand-range@1.8.2(transitive)
+ Addedextend-shallow@2.0.13.0.2(transitive)
+ Addedextglob@0.3.22.0.4(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedfilename-regex@2.0.1(transitive)
+ Addedfill-range@2.2.44.0.0(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfor-own@0.1.5(transitive)
+ Addedfragment-cache@0.2.1(transitive)
+ Addedfsevents@1.2.13(transitive)
+ Addedget-value@2.0.6(transitive)
+ Addedglob-base@0.3.0(transitive)
+ Addedglob-parent@2.0.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-value@0.3.11.0.0(transitive)
+ Addedhas-values@0.1.41.0.0(transitive)
+ Addedis-accessor-descriptor@1.0.1(transitive)
+ Addedis-binary-path@1.0.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-data-descriptor@1.0.1(transitive)
+ Addedis-descriptor@0.1.71.0.3(transitive)
+ Addedis-dotfile@1.0.3(transitive)
+ Addedis-equal-shallow@0.1.3(transitive)
+ Addedis-extendable@0.1.11.0.1(transitive)
+ Addedis-extglob@1.0.0(transitive)
+ Addedis-glob@2.0.1(transitive)
+ Addedis-number@2.1.03.0.04.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-posix-bracket@0.1.1(transitive)
+ Addedis-primitive@2.0.0(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.03.0.1(transitive)
+ Addedkind-of@3.2.24.0.06.0.3(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmap-visit@1.0.0(transitive)
+ Addedmath-random@1.0.4(transitive)
+ Addedmicromatch@2.3.113.1.10(transitive)
+ Addedmixin-deep@1.3.2(transitive)
+ Addednan@2.22.0(transitive)
+ Addednanomatch@1.2.13(transitive)
+ Addednormalize-path@2.1.1(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedobject-visit@1.0.1(transitive)
+ Addedobject.omit@2.0.1(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedparse-glob@3.0.4(transitive)
+ Addedpascalcase@0.1.1(transitive)
+ Addedposix-character-classes@0.1.1(transitive)
+ Addedpreserve@0.2.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedrandomatic@3.1.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreaddirp@2.2.1(transitive)
+ Addedregex-cache@0.4.4(transitive)
+ Addedregex-not@1.0.2(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedresolve-url@0.2.1(transitive)
+ Addedret@0.1.15(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsafe-regex@1.1.0(transitive)
+ Addedset-value@2.0.1(transitive)
+ Addedsnapdragon@0.8.2(transitive)
+ Addedsnapdragon-node@2.1.1(transitive)
+ Addedsnapdragon-util@3.0.1(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsource-map-resolve@0.5.3(transitive)
+ Addedsource-map-url@0.4.1(transitive)
+ Addedsplit-string@3.1.0(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedto-regex@3.0.2(transitive)
+ Addedto-regex-range@2.1.1(transitive)
+ Addedunion-value@1.0.1(transitive)
+ Addedunset-value@1.0.0(transitive)
+ Addedurix@0.1.0(transitive)
+ Addeduse@3.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)