stub-server-node

1.1.1 • Public • Published

stub-server

Build Status

This is stub server based on node.js. It was inspired by stubby4node but it have minimum feature set, which are required to stub simple REST api for varios end 2 end test for UI applications

Install

npm install stub-server-node --save-dev

Basic Usage

This code will generate translation json files based on google spreadsheet:

const stub= require('stub-server-node');
//to start
var options = {
    stubs:['<stub file 1>', '<stub file 2>']
};
stub.serve(options);
 
//to stop
stub.stop();

Options

stubs mandatory

Type: Array of Strings

List of json files with http schema, example:

{
  "request": {
    "url": "/api/test",
    "method": "POST"
  },
  "response": {
    "status": 200,
    "headers": {
      "Content-Type": "application/json"
    },
    "body": {
      "result": "ok"
    }
  }
}

port optional

Type: Number

default port is 8888

serts optional

Type: Object { key: '<path for cert key>', cert: '<path for cert>' } default serts is null

tls_port optional

Type: Number

default port is 8887

Readme

Keywords

Package Sidebar

Install

npm i stub-server-node

Weekly Downloads

2

Version

1.1.1

License

MIT

Last publish

Collaborators

  • mikhail.angelov