Gathering detailed insights and metrics for dsg-mock-restful-express
Gathering detailed insights and metrics for dsg-mock-restful-express
Gathering detailed insights and metrics for dsg-mock-restful-express
Gathering detailed insights and metrics for dsg-mock-restful-express
npm install dsg-mock-restful-express
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
3 Stars
32 Commits
2 Forks
1 Watchers
2 Branches
1 Contributors
Updated on Nov 08, 2016
Latest Version
0.0.3
Package Id
dsg-mock-restful-express@0.0.3
Size
8.36 kB
NPM Version
3.10.2
Node Version
6.9.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A RESTful mock server powered by Express.js
The purpose of this project is to provide a generic RESTful API server based on mocked responses, defined programatically and with support to many features like:
This project is based on the concepts of Express.js routing. Those features are provided by a library called dynamic-routes, and all routes can be defined programatically with support to all HTTP methods (GET, POST, PUT and DELETE) within the routes folder.
To know better these routes conventions, take a look on the project examples to understand the concepts.
This project is also based on mocked responses, defined programatically in a convetional manner, within the mocks folder.
The /examples folder within this project contains all the references explained below. To see them in practice, make the mock-server install through npm, as explained below:
1npm install mock-restful-express -g
This command make a installation of this library within node global dependencies folder. To run the mock server, within the examples folder, run the following on the terminal:
1mock-server
This should initiate a new instance of the server on the default port (8880).
The mocks path structure are the defined based on routes path. For example, suppose we have an /foo route defined on the project, with support to GET action. The respective mocked reponse of this route is structured as follows:
- mocks
|-- foo
|--- get
|---- 1.json
|---- all.json
|---- foo=bar.json
This structure is also adaptive to define mocked responses for POST, PUT and DELETE actions whenever necessary.
All mock responses also are based on some conventions, defined in a structure as follows:
1{ 2 "code": 200, 3 "content" : { 4 "bar" 5 } 6}
This structure defines a response HTTP code (with support to all HTTP codes) and payload, represented by content node.
A GET request on a route path with path param like /foo/1 is conventionally mapped to 1.json file, defined in a structure like shown below:
- mocks
|-- foo
|--- get
|---- 1.json
A GET request on a route path with query param like /foo/?foo=bar&bar=foo, its convetionally mapped to a foo=bar&bar=foo.json file, defined in a structure like shown below:
- mocks
|-- foo
|--- get
|---- foo=bar&bar=foo.json
A GET request on a route path defined for a subresource like /foo/1/bar/2, its convetionally mapped to a 1_2.json file, defined in a structure like shown below:
- mocks
|-- foo
|--- bar
|---- get
|---- 1_2.json
All requests received from your project routes could be conventioned to have a defined mocked response. For GET methods like /foo, its expected to have a all.json file defined to response for the request. In case of PUT or DELETE actions, the default response is agreed to be defined with HTTP Code 204 without any body. In case of POST requests, the default response is defined to have HTTP Code 200 without any body.
In case of some route doesn´t have its respective mocked response, a message will be sent with HTTP Code 404 and body with a descriptive error message.
This behavior could be easily supported by your project's routes through a library MockHTTP, defined on this project. To know better this libray usage, take a look at this project example section.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 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
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
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