
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
stub-server
Advanced tools
Stub server is node.js based server for mocking request. Simple configuration format (JSON), responses can be in different files and types.
#Installation
npm i stub-server
#Usage
Like server:
var stubServer = require('stub-server');
stubServer.config('configuration.json');
stubServer.run();
Middleware:
var stubServer = require('stub-server');
stubServer.config('configuration.json');
stubServer.requestHandler(req, res, next);
Other usage examples are here
#Configuration
config - method that configure stub server with server params and stubs. It can be a string value (path to configuration JSON file) and a js object.
config.server - configuration for node.js server, that will be started.
config.stub - array with requests.
Stub configuration:
request - request path [required]
response - response for this stub, can be a string, JSON, object, path to file [required]
file (true/false) - if it's true, and response is path to file, stub server return response file data with correct mime type.
strictData (if method is 'get' ignored, default false) - if true stub server select response with most appropriate data
data - response data in object format
headers (array) - add this headers to response
#Contributing
You are welcome :)
If you find bug or want some changes, please, create an issue
v.v.semykin@gmail.com - is my own email. Commits are also from work emails, that can be blocked :)
#License
GNU. Fill free to do something good for people
FAQs
Stub server which do response depends on json configuration file
The npm package stub-server receives a total of 19 weekly downloads. As such, stub-server popularity was classified as not popular.
We found that stub-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.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.