Coder Social home page Coder Social logo

easy-mock-server's Introduction

stable

Introduction

EasyMockServer is a mock server for json and mock template files.It can map you json/mockJs file to RESTful url easily. NPM

Install

You can install easy-mock-server as local package

 $ npm install easy-mock-server

or global package

$ npm install -g easy-mock-server

Usage

Basic

 $ easyMockServer

If you mock file tree like this

│
├─mock
│  │  basic.json
│  │
│  ├─auth
│  │      login.json
│  │      logout.json
│  │      user.template
│  │
│  └─goods
│          beverage.json

The mapping will be

./mock/basic.json           -->    http://localhost:8124/mock/basic
./mock/auth/login.json      -->    http://localhost:8124/mock/auth/login
./mock/auth/logout.json     -->    http://localhost:8124/mock/auth/logout
./mock/auth/user.template   -->    http://localhost:8124/mock/auth/user
./mock/goods/basic.json     -->    http://localhost:8124/mock/goods/basic
  • The json file will be returned directly.
  • The template file will be translated by mockJs before return. See mockJs document
  • Other file will be ignored.

Change port

$ easyMockServer -p 8088
$ easyMockServer --port 8088

change base path

$ easyMockServer -b ./mock
$ easyMockServer --basePath ./mock

set lag

$ easyMockServer -l 4000
$ easyMockServer --lag 4000

easy-mock-server's People

Contributors

geminate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.