mockjs-middleware
v0.0.2
Published
a mockjs middleware for express
Downloads
2
Readme
mockjs-middleware
一个express中间件,主要完成开发服务器中的mock功能
安装
$ npm install mockjs-middleware
使用
var mock = require('mockjs-middleware')
var app = require('express')()
var path = require('path')
app.use(mock(path.resolve(__dirname, './mock.js')))
mock(path)
path
mock数据文件的路径,文件内容类似于
module.exports = {
'/a': {
url: 'a'
},
'/b': function (req) {
return {
url: 'b'
}
},
'/c': {
'list|2': ['1']
}
}
可以使用mockjs的语法规范,快速生成数据 mockjs