Gathering detailed insights and metrics for mock-restful-server
Gathering detailed insights and metrics for mock-restful-server
npm install mock-restful-server
Typescript
Module System
Node Version
NPM Version
79.1
Supply Chain
99.5
Quality
75.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
1,399
Last Day
9
Last Week
12
Last Month
27
Last Year
160
15 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.8
Package Id
mock-restful-server@1.0.8
Unpacked Size
1.12 MB
Size
169.57 kB
File Count
21
NPM Version
6.14.14
Node Version
12.22.4
Cumulative downloads
Total Downloads
Last day
0%
9
Compared to previous day
Last week
0%
12
Compared to previous week
Last month
800%
27
Compared to previous month
Last year
-27.6%
160
Compared to previous year
A lightweight restful api mock server using models.
*Note: /login and /signup routes are reserved for authentication related mocking.
1$ npm install mock-restful-server
1function start(models, data, mode, port = 0)
*Note: without specifying the port argument a random port will be allocated by the system. The server listening address will be logged in the console at start.
1const mockRestfulServer = require('mock-restful-server');
1const models = { 2 users: { 3 email: { 4 type: "string", 5 required: true 6 }, 7 name: { 8 type: "string", 9 required: true 10 }, 11 address: { 12 type: "string" 13 } 14 }, 15 cars: { 16 name: { 17 type: "string", 18 required: true 19 }, 20 brand: { 21 type: "string", 22 required: true 23 }, 24 year: { 25 type: "number" 26 } 27 } 28}
*Note: supported model attributes are "type" and "required". type can be either "number", "string", "boolean", "array" or "map".
1const data = { 2 users: [{ 3 email: 'john.doe@gmail.com', 4 name: 'John Doe', 5 address: 'Central Park Lake, NY' 6 }], 7 cars: [{ 8 name: 'Mustang' 9 brand: 'Ford', 10 year: '1970' 11 }] 12}
1const mode = 'STRICT'
*Note: supported modes are STRICT and OPEN. OPEN is the default mode. In STRICT mode, two case will lead the server to throw an exception at saving time : trying to save a record with no model previously defined and trying to save a record having at least one field which doesn't exist in its model structure.
1const { port, stop } = mockRestfulServer.start(models, data, mode, 8080)
1// stop the server 2stop()
1$ npm install -g mock-restful-server
1$ mock-restful-server --models=models.json --data=data.json --mode=STRICT --port=8080
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
6 existing vulnerabilities detected
Details
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More