🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

express-mockjs-middleware

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-mockjs-middleware

An Express mockjs middleware

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
8
14.29%
Maintainers
1
Weekly downloads
 
Created
Source

express-mockjs-middleware

An Express mockjs middleware

Install

npm install express-mockjs-middleware

Usage

var expressMock = require('express-mockjs-middleware');
app.use('/mock',expressMock(path.resolve(__dirname,'../mock')));

Example

//file in /mock/test.js  => /mock/test?page=1
module.exports = {
    // 属性 list 的值是一个数组,其中含有 1 到 10 个元素
    'list|1-10': [{
        // 属性 id 是一个自增数,起始值为 1,每次增 1
        'id|+1': '@page' //占位符,会自动将参数page的值填在这里
    }]
}

Feature

  • Mockjs Syntax (https://github.com/nuysoft/Mock/wiki/Syntax-Specification)
  • support .js .json
  • Auto extend Mock.Random by url params

Keywords

mockjs

FAQs

Package last updated on 08 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts