A configurable mock server with an intuitive configuration management interface and a http api.
- clone/download this repository
- make sure you have node and npm installed
- run
npm install
to download required packages node server.js
to run the server
- npm install -g mocknode
- run
mocknode
to start the server
- npm install --save mocknode
- add an npm script entry in the package.json
"mocknode": "mocknode"
- run
npm run mocknode
to start the server
and open https://localhost:3000/mocknode/ in your browser to configure mocknode
https://mocknode.herokuapp.com/mocknode/ please go easy on this :)
The order of preference for the port on which mocknode runs is:
env variable of process > port option passed > 3000
mocknode --port 4000
starts the server on port 4000, unless a PORT env variable exists for the process.
Open https://localhost:3000/mocknode/ in your browser to configure mocknode
All your changes are saved in the config files - config.json, config-stub.json and the stubs folder, which ensure all your changes are saved if you restart mocknode.
Mocknode exposes a series of endpoints which can help you integrate mocknode with your code - [ test scripts for example ]
enpoint | method | params |
---|---|---|
/mocknode/api/config | GET | - |
/mocknode/api/stubconfig | GET | - |
/mocknode/api/getstub | GET | name |
/mocknode/api/modifyroute | POST | route config |
/mocknode/api/deleteroute | GET | route |
/mocknode/api/modifystub | POST | stub config |
/mocknode/api/deletestub | GET | name |
/mocknode/api/modifydynamicstub | POST | stub config |
/mocknode/api/deletedynamicstub | GET | name |
mocknode interface uses the above endpoints to interact with the server, inspect the network of the browser to better understand the parameters used in each api.
The config files and the stubs folder mentioned above have all the information regarding your configuration.
MIT