
Company News
Socket Partners with Replit to Block Malicious Packages in AI-Powered Development
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.
npm i simulado --save-dev
This will keep the server alive until the process is killed (unlike the below).
./node_modules/.bin/simulado
-p, --port - Port number that Simulado should start on.
-f, --file - Path to a JSON file containing mocks to mock on startup.
-c, --cert <filepath> - Path to certificate
-k, --key <filepath> - Path to certificate key
Once Simulado has started, going to http://localhost:<SIMULADO_PORT_NUM> will display a list of mocked endpoints and their responses.
import simulado from 'simulado';
import axios from 'axios';
(async function() {
// Start Simulado server
await simulado.start();
// Mock a response
await simulado.setMock({
path: '/data',
body: 'Hello World!'
});
// Make a request
const response = await axios.get('http://localhost:7001/data');
console.log(response.data); // => 'Hello World!'
// Stop Simulado server once done
await simulado.stop();
})();
start([options])Start Simulado
<Object>
port <number> - Specify the port number to start Simulado on. Default: 7001https <object> - Enable https support
key <string> - path to key filecert <string> - path to cert filesetRemoteServer(url)Sets the url of a simulado instance on which the client should set mocks, for use if simulado lives on another server.
url <String> for example https://my-simulado-server.herokuapp.comisRunning()Returns true if simulado is running. Returns false if simulado is not started.
setMock(mockResponse)Sets a mock response
mockResponse <MockResponse> - Add a response to the store. Full options MockResponse.setMocks(mockResponses)Sets multiple mock responses
mockResponses [<MockResponse>] - Add responses to the store. Full options MockResponse.setDefaults(mockResponses)Clears mocked responses and sets new mocked responses
mockResponses [<MockResponse>] - Add responses to the store. Full options MockResponse.lastRequests(method, path[, limit])Fetch the last requests for a path
method <String> - The request method for the requests you want to fetchpath <String> - The path of the requests you want to fetchlimit <number> - Only return the given number of last requestslastRequest(method, path)Fetch the last request for a path
method <String> - The request method for the requests you want to fetchpath <String> - The path of the requests you want to fetchclearResponse(method, path)Clear mocked response from the store
method <String> - The HTTP request method to clear saved response frompath <String> - The path to match against when clearingclearResponses()Clear all mocked responses from the store.
clearRequest(method, path)Clear captured request from the store
method <String> - The HTTP request method to clear saved request frompath <String> - The path to match against when clearingclearRequests()Clear all captured requests from the store.
stop()Stop Simulado.
{
// Path - Mandatory - The HTTP request path that you want the mock to response to.
path: '/testPath', // String path
path: /\/testPath/.*/, // Regex path
method: 'GET', // Optional (defaults to GET if not set) - The HTTP request method that you want the mock to response to.
status: 200, // Optional (defaults to 200 if not set) - The HTTP status you want to mock to response with.
headers: {
'X-Custom-Header': 'Custom Header Value'
}, // Optional - The HTTP headers you want the mock to respond with.
body: {
data: 'DATA'
}, // Optional - The HTTP response body you want the mock to respond with.
conditionalHeaders: {
needMe: 'true'
}, // Optional - The mock with only response if the conditional headers are sent in the request.
conditionalBody: {
data: 'YouNeedThisData'
}, // Optional - The mock will only response if the conditional body is sent in the request.
delay: 5000 // the time (in milliseconds) to wait until responding to a request
}
FAQs
A simple nodejs mockserver
The npm package simulado receives a total of 102 weekly downloads. As such, simulado popularity was classified as not popular.
We found that simulado demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.