
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
imitate
is a REST API mocking tool. It offers a simple workflow for:
imitate
is useful for end-to-end testing, offline development, and other situations where you want to access a close (but no cigar) copy of your real REST API. It is agnostic to your choice of backend or frontend.
Install it like any other node package, if using inside a project:
$ npm install imitate
To use the command-line API (coming soon), install it globally:
$ npm install -g imitate
To instantiate a proxyServer:
var proxyServer = require('imitate').proxyServer;
var proxy = proxyServer({
output: 'endpoints.json',
url: 'https://api.github.com/',
});
This will start a proxyServer on http://localhost:4000
, which will return the results from pinging https://api.github.com/ while also writing them in a file called 'endpoints.json' in the current working directory. See below for additional options.
You can stop it like any other express
server:
proxy.close(/* callback */);
To instantiate a mockServer:
var mockServer = require('imitate').mockServer;
var mock = mockServer({
input: 'endpoints.json',
});
This will start a mockServer on http://localhost:4000
, which will use endpoints.json
to imitate all the previously stored endpoints. See below for additional options.
You can stop it like any other express
server:
mock.close(/* callback */);
Coming soon!
You can start a proxyServer
with the following options:
var proxyServer = require('imitate').proxyServer;
var proxy = proxyServer({
// Mandatory parameters.
url: 'https://api.github.com/', // URL to proxy.
// Optional parameters. The values specified here are the defaults.
port: 4000, // Port on which to start the server.
host: 'localhost', // Hostname for the server.
output: 'endpoints.json', // Output file in which the responses will be cached.
silent: false, // Pass in 'true' to silence console.logs.
});
You can start a mockServer
with the following options:
var mockServer = require('imitate').mockServer;
var proxy = mockServer({
// All optional parameters. The values specified here are the defaults.
port: 4000, // Port on which to start the server.
host: 'localhost', // Hostname for the server.
input: 'endpoints.json', // Input file containing the cached responses.
silent: false, // Pass in 'true' to silence console.logs.
});
MIT.
FAQs
Fast API mocking tool.
We found that imitate 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.