GithubHelp home page GithubHelp logo

node-mock-rest's Introduction

Node Mock REST App

Description

This application gives your project easy setup for mock services.

Blog Post: Novice Lab

Installation

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.

Limitations

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

node-mock-rest's People

Contributors

shivrajrath avatar

Watchers

 avatar  avatar  avatar

Forkers

abhardwaj4

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.