stub-server
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= ;//to startvar options = stubs:'<stub file 1>' '<stub file 2>';stub; //to stopstub;
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