window下启动本地easymock
1.安装 Node.js(>= v8.9)& MongoDB(>= v3.4)& Redis(>= v4.0)
安装MongDB https://www.runoob.com/mongodb/mongodb-window-install.html
安装Redis https://www.runoob.com/redis/redis-install.html
检查是否安装成功
node.js能用npm就成功了,或者输出node版本
mongodb 找到安装后的文件夹(一般默认是在C:\Program Files\MongoDB\Server\4.0\bin里面),双击mongo.exe输入db回车显示test数据库就成功了
2.安装easymock
git clone https://github.com/easy-mock/easy-mock.git
cd easy-mock && npm install
// 启动
npm run dev
找到 config/default.json,或者创建一个 config/local.json 文件,将如下需要替换的字段换成自己的配置即可。(默认是不需要修改配置文件的)
{ "port": 7300, "host": "localhost", "pageSize": 30, "proxy": false, "db": "mongodb://localhost/easy-mock", "unsplashClientId": "", "redis": { "keyPrefix": "[Easy Mock]", "port": 6688, "host": "192.168.0.25", "password": "XZg1bronaALyjIZ", "db": 0 }, "blackList": { "projects": [], "ips": [] }, "rateLimit": { "max": 1000, "duration": 1000 }, "jwt": { "expire": "14 days", "secret": "shared-secret" }, "upload": { "types": [".jpg", ".jpeg", ".png", ".gif", ".json", ".yml", ".yaml"], "size": 5242880, "dir": "../public/upload", "expire": { "types": [".json", ".yml", ".yaml"], "day": -1 } }, "ldap": { "server": "", "bindDN": "", "password": "", "filter": { "base": "", "attributeName": "" } }, "fe": { "copyright": "", "storageNamespace": "easy-mock_", "timeout": 25000, "publicPath": "/dist/" } }
3. 启动mongodb, redis, 然后启动easyMock项目