Coder Social home page Coder Social logo

pankajpatel / mock-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ianunay/mock-node

0.0 3.0 0.0 880 KB

A configurable mock server with an intuitive configuration management interface and a http api

JavaScript 94.21% CSS 1.95% HTML 3.84%

mock-node's Introduction

Mock Node

A configurable mock server with an intuitive configuration management interface and a http api.

Build Status

Installing and Runing the server

Standalone

  1. clone/download this repository
  2. make sure you have node and npm installed
  3. run npm install to download required packages
  4. node server.js to run the server

npm global install

  1. npm install -g mocknode
  2. run mocknode to start the server

npm local install

  1. npm install --save mocknode
  2. add an npm script entry in the package.json "mocknode": "mocknode"
  3. run npm run mocknode to start the server

and open https://localhost:3000/mocknode/ in your browser to configure mocknode

A running instance on heroku

https://mocknode.herokuapp.com/mocknode/ please go easy on this :)

The port

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.

Mocknode configuration

Open https://localhost:3000/mocknode/ in your browser to configure mocknode

alt tag

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.

HTTP API

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.

Troubleshooting

The config files and the stubs folder mentioned above have all the information regarding your configuration.

License

MIT

mock-node's People

Contributors

ianunay avatar

Watchers

Pankaj Patel avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.