Application to host mock REST services for your project
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
service Updates blog URL Jun 22, 2015
.gitignore Additional documentation Jun 22, 2015
constants.json Changes the way POST works Jun 21, 2015
index.js Additional documentation Jun 22, 2015
package.json Additional documentation Jun 22, 2015

Node Mock REST App


This application gives your project easy setup for mock services.

Blog Post: Novice Lab


npm install node-mock-rest

Pre Requisite

  • Node JS

Starting the app

  • Run npm start
  • App would run on localhost:3333
  • If you want to run on different port run PORT=<new_port> npm start

How to use

  • GET

    Put your json file inside service folder in same structure as of your request URL e.g: /profile/1234 would be service / profile (folder) / 1234.json You don't need to restart the app

  • POST

    Data in request body will be written to the file mentioned in the POST url. For e.g.: /profile/1234 would create a file 1234.json inside profile folder and write the request body to it. By default, the response would be a success. However, if you need a custom response, create a file postresp/1234.json

  • Other Requests For requests like PUT/DELETE etc you'll allways get a success response

  • CORS It's enabled for all origin. You need to add specific domain to res.header('Access-Control-Allow-Origin', '*'); to control.


  • Cannot create authentication scenarios
  • Adding or deleting data not possible currently
  • Limited to Content-Type application/json