New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-mock-server

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-mock-server

Mock server powered by Express.js

  • 3.4.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
213
decreased by-18.7%
Maintainers
0
Weekly downloads
 
Created
Source

express-mock-server

Mock server powered by Express.js

Installation

npm i -D express-mock-server

Example of source file

module.exports = [
  {
    request: {
      'method': 'GET',
      'path': '/some-url'
    },
    response: {
      'statusCode': 200,
      'body': JSON.stringify({
        'param1': 'some text',
        'param2': 123123,
        'param3': false
      })
    }
  }
];

Response can be a function

response: function(urlParams, qsParams, bodyParams) {
  ...

Basic use

import { serverStart } from 'express-mock-server';

var sources = [
  require('./mock/source1.js'),
  require('./mock/source2.js'),
  ...
];

// this is default configuration
var opt_serverConfig = {
  port: 8080,
  controlApiUrl: '/api/v1'
};

/**
 *  Return strated Server instance
     function can be called are 
        start
        close
 *  @param {Array} sources
 *  @param {?Object} opt_serverConfig
 *  @return {Server}
 */
serverStart(sources [, opt_serverConfig])
  

Keywords

FAQs

Package last updated on 27 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc