1.0.9 • Published 4 years ago
maxs-mock v1.0.9
maxs-mock
安装
npm install --save-dev maxs-mock
使用说明
安装依赖包之后,在项目package.json
若要是用本地mock,其中mockConfig是配置文件
- "scripts": {
- ...
- "mock": "cross-env mockConfig=mock.config.js maxs-mock ",
- },
- "scripts": {
若要使用代理服务, 需配置mode对方服务器ip
- "scripts": {
- ...
- "proxy": "cross-env mode=http://localhost:6666 maxs-mock "
- },
- "scripts": {
两种都配置
- "scripts": {
- ...
- "mock": "cross-env mockConfig=mock.config.js maxs-mock ",
- "proxy": "cross-env mode=http://localhost:6666 maxs-mock "
- },
- "scripts": {
mock.config.js中
- module.exports = {
- /* 启动服务时,获取给定的端口 /
- apiPort: 8000,
- /* 启动服务时,传入的文件路径 /
- apiPath: 'mocks',
- /* 启动服务时,是否查询子目录 默认false /
- apiIsSubDir: true,
- /* 启动服务时,文件匹配规则 默认匹配规则为/.mock.js$/ /
- apiRegExp: /.mock.js$/
- };
- module.exports = {