
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mocker-server
Advanced tools
A server to easily mock api requests, ideal for situations where you need to test api calls without having the backend server running.
The server will use nedb to store the requests locally.
This is not intended to be used in production environment.
| Flag | Description |
|---|---|
| --config [file] or -c [file] | 'Path to the config file' |
| --save [file] | 'Create a config file with the default configurations' |
| --port [port] or -p [port] | 'Express port number' |
| --strict-url | 'Validate model url' |
| --ttl | Default ttl for mocks, in seconds. ONLY work with strict-url=true |
| --db-path | 'Path to db file' |
| --in-memory | 'Run using a memory database' |
The configuration will be stored in a json file, if no --config options is used, it will look for a .mockerserver.json in the running folder, if there is no default configuration file and no configuration file is specified, the default configurations will be used.
Your configuration should looks like:
{
//Specify express port
"express.port":3000,
//Validate the url for the apis
"mocker.strictUrl":false,
//Default ttl for mocks
"mocker.ttl": 0,
//Database type, only nedb for now
"db.type":"nedb",
//path to save database files
"db.url":"mocker.db",
//Database specific options
"db.options":{
"inMemoryOnly":false
}
}
It is possible to pass the flag --save [file] to save the configuration to a given file
GET /api/mock/{model}
Return the listing for the given model
GET /api/mock/{model}/count
Return the count for the given model
GET /api/mock/{model}/{id}
Return the item that match the id for the given model
POST /api/mock/{model}
Insert a new item for the given model
PUT /api/mock/{model}/{id}
Update the item that match the id for the given model
DELETE /api/mock/{model}/{id}
Delete the item that match the id for the given model
The list and counting methods accept filter parameters through query string
Possible filters are:
if the option --strict-url is used, then is necessary to register the models before utilization
POST /api/model { name: "newmodel", ttl: 0 } Register a new model
GET /api/model
Return existent models
DELETE /api/model/{model}
Delete a given model
FAQs
A server to mock api requests
The npm package mocker-server receives a total of 1 weekly downloads. As such, mocker-server popularity was classified as not popular.
We found that mocker-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.