simple-json-replay-server
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "simple-json-replay-server", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"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", |
@@ -1,6 +0,4 @@ | ||
# 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) | ||
Pefect companion with single page application development, and unit mock testing. Especially designed for angularjs 1 and 2 & reactjs. | ||
> Current Version: 0.0.6 | ||
## It is not a Restful Json Server | ||
@@ -101,13 +99,17 @@ Have you spent a lot of time trying to find a **simple straight-forward file based json replay server** which will just matching path and query parameters and return response which matching you expect? | ||
### ✦ Request | ||
### ✦ Request (Filtering Rules) | ||
The request object can be defined as below propertities. | ||
You can possibly define as many as mock data configs which match the same path. However, the mock sever will return the best matching mock data based on a ranking algorithm. if more than one mock data get the same matching ranking, we will not guarantee which one will return. | ||
The request object can be defined as described in below table. | ||
You can define as many as mock data configs which map to the same path. Then, you can define more filtering rules which can narrow down the results. | ||
However, if more than one mock data match the same filtering criteria, we will not guarantee which one will return. | ||
Key | Value | Optional | Description | ||
---------|----------|----------|--------- | ||
path | part of path or full path | No | You can give part of path or full path, for example, the full path is "/api/examples", you can give just "examples" or "example" or "/examples", all of them will match. | ||
method | http methods | Yes | default as **get** | ||
query | a json map with key value pairs | Yes | you can only give keys which you want to match. default as **undefined** | ||
path | part of path or full path | No | You can give partial of path or full path, for example, the full path is "/api/examples", you can give just "examples" or "example" or "api/examples", all of them will match. | ||
method | http methods | Yes | Default as **get** | ||
query | a json map with key value pairs | Yes | Default as **undefined**. You can think about this is a filtering logic. As long as you defined a key-value, it will only allow request which contains this query parameter and same value to pass through. | ||
@@ -132,3 +134,2 @@ ### ✦ Response | ||
With this simple json replay server approach, **your code is always the same code which you will use in production**, and in local development environment, you can route all your backend restful service calls to this replay server and thus you can run and play with your frontend applicati | ||
With this simple json replay server approach, **your code is always the same code which you will use in production**, and in local development environment, you can route all your backend restful service calls to this replay server and thus you can run and play with your frontend application without **ANY dependency** on your backend server. | ||
@@ -135,0 +136,0 @@ |
24154
14
216