Gathering detailed insights and metrics for restful-dummy-server
Gathering detailed insights and metrics for restful-dummy-server
npm install restful-dummy-server
Typescript
Module System
Node Version
NPM Version
64.3
Supply Chain
94.9
Quality
73.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
671
Last Day
5
Last Week
13
Last Month
23
Last Year
125
6 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
restful-dummy-server@1.0.4
Unpacked Size
12.24 kB
Size
3.82 kB
File Count
9
NPM Version
6.14.17
Node Version
14.20.0
Publised On
25 Jun 2023
Cumulative downloads
Total Downloads
Last day
-37.5%
5
Compared to previous day
Last week
62.5%
13
Compared to previous week
Last month
2,200%
23
Compared to previous month
Last year
-77.1%
125
Compared to previous year
3
This can be used to mock Rest API responses.
npm install -g restful-dummy-server
1"scripts": { 2 "start": "restful-dummy-server -port 4000" 3}
This will start restful dummy server on port 4000
You can also mention host.
1"scripts": { 2 "start": "restful-dummy-server -port 4000 -host xx.xx.xx.xx" 3}
1"scripts": { 2 "start": "restful-dummy-server -port 4000 -static ./data" 3}
static is used to know the relative path of a folder where all statics files are hosted. Which then would be used by Dummy server to download files against the rest api dowbloaded request. Here this folder is data.
1"scripts": { 2 "start": "restful-dummy-server -port 4000 -static ./data -config ./test" 3}
config is used to know the relative path of a folder which are having dummy request response instruction files in .json extensions only.
Note -
Example 1- test/config.json
1[{ 2 "request": { 3 "url": "/get/message", 4 "method": "get" 5 }, 6 "response": { 7 "headers": {}, 8 "body": "Hello Dummy Server" 9 } 10}]
In this case if you hit http://localhost:5000/get/message then you will get Hello Dummy Server as response.
Example 2- test/config.json
1[{ 2 "request": { 3 "url": "/get/:message", 4 "method": "get" 5 }, 6 "response": { 7 "headers": {}, 8 "body": { "message": "Hello Dummy Server" } 9 } 10}]
In this case if you hit http://localhost:5000/get/test or http://localhost:5000/get/msg etc. then you will get { "message": "Hello Dummy Server" } as response.
Example 3- test/config.json
1[{ 2 "request": { 3 "url": "/get/png/*.*", 4 "method": "get" 5 }, 6 "response": { 7 "headers": { 8 "Content-Disposition": "attachment;filename= test.png;" 9 }, 10 "body": "./test.png" 11 } 12}]
In this case if you hit http://localhost:5000/get/png/abc.png or http://localhost:5000/get/png/msg.png etc. then test.png will be downloaded as response.
Example 4- test/config.json
1[{ 2 "request": { 3 "url": "/get/**/*.*", 4 "method": "get" 5 }, 6 "response": { 7 "headers": { 8 "Content-Disposition": "attachment;filename= test.png;" 9 }, 10 "body": "./test.png" 11 } 12}]
In this case if you hit http://localhost:5000/get/png/abc.png or http://localhost:5000/get/png/png2/msg.jpeg etc. then test.png will be downloaded as response.
Example 5- test/config.json
1[{ 2 "request": { 3 "url": "/get/**/*.png", 4 "method": "get" 5 }, 6 "response": { 7 "headers": { 8 "Content-Disposition": "attachment;filename= test.png;" 9 }, 10 "body": "./test.png" 11 } 12}]
In this case if you hit http://localhost:5000/get/png/abc.png or http://localhost:5000/get/png/png2/msg.png etc. then test.png will be downloaded as response.
Example 6- test/config.json
1[{ 2 "request": { 3 "url": "/get/**/*.png", 4 "method": "get" 5 }, 6 "response": { 7 "headers": { 8 "Content-Disposition": "attachment;filename= test.png;" 9 }, 10 "body": "./test.png", 11 "delay": 2000 12 } 13}]
Above delay is the special attribute which would cause Dummy server to respond in 2000 milliseconds.
1"scripts": { 2 "start": "restful-dummy-server -port 4000 -static ./data -config ./test -proxy localhost:2000" 3}
If proxy is provided then Dummy server will redirect the request to the proxy server if there is no matching record found.
No vulnerabilities found.
No security vulnerabilities found.