@gjuro/my-mock-cli
v2.0.0
Published
Simple mock HTTP using json config
Downloads
3
Readme
my-mock-cli
Simple mock HTTP API using json config
BREAKING CHANGES
structure changed
{
"mappings" => "@endpoints" :
{
"request" => "@request" : "GET /api/users/1",
"response": => "@response" {
"body": => "@body" {
"id": 1,
"title": "test 1"
}
}
}
]
}
MOCK FILE STRUCTURE AND ATTRIBUTES
{
"@endpoints": [
{
"@request": "GET /api/users/1",
"@response": {"id": 1,"title": "user 1"}
}
]
}
FEATURES
defined mockfile structure and attributes
- fix structure if possible
- change datault port
- generate sample mock files
- outputs result of json parsing steps and variable evaluation (--verbose)
- ...
- using "handlebars" sintax + custom adjustments https://github.com/handlebars-lang/handlebars.js
- nested atributes
- template objects
- dynamic objects and arrays
- random data
- ...
linking to external file/s in mock structure
- variable evaluation in all files
custom maping for request & response (support for custom log)
- map custom log to defalt mock atributes
USAGE
Install
npm install -g @gjuro/my-mock-cli
Create default sample files and folders in curent shell folder
my-mock-cli --init
Start server
my-mock-cli
goto: http://localhost:3000/api/users/1, you will get
{"id":1,"title":"test 1"}
EXAMPLES
TODO
TODO - stuff to be done
- response: conten type
- response: headers
- response http status code
- multipart request
- static files
- request| response variables
- response random variables (num,date,text)
- response date now +format variable
- response template x rows , s time da i x može biti random
- cors
- upload 1 file
- upload multiple files
- get 1 file
- content disposition
- from url
- from loca file
- base 64
- SSL
- ....