Easy mock is a relatively easy-to-use interface simulation tool,
We need to install and configure before using
The content to download is as follows
Node and Redis can click next. MongoDB can refer to MongoDB Installation and operation
After installation, you can download easy mock from github and start using it
$ git clone https://github.com/easy-mock/easy-mock.git $ cd easy-mock && npm install
The configuration file can be modified after the dependency installation
The configuration file is located in config/default.json under the directory, or create a config/local.json file. Change the following fields to your own configuration.
Official configuration template:
{ "port": 7300, "host": "0.0.0.0", "pageSize": 30, "proxy": false, "db": "mongodb://localhost/easy-mock", "unsplashClientId": "", "redis": { "keyPrefix": "[Easy Mock]", "port": 6379, "host": "localhost", "password": "", "db": 0 }, "blackList": { "projects": [], // projectId,Example:"5a4495e16ef711102113e500" "ips": [] // ip,Example:"127.0.0.1" }, "rateLimit": { // https://github.com/koajs/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": "", // Set up server Representative opening LDAP Sign in. Example:"ldap://localhost:389 "or" ldaps://localhost:389 "(using SSL) "bindDN": "", // User name, for example:"cn=admin,dc=example,dc=com" "password": "", "filter": { "base": "", // Query the path of the user, for example:"dc=example,dc=com" "attributeName": "" // Query fields, for example:"mail" } }, "fe": { "copyright": "", "storageNamespace": "easy-mock_", "timeout": 25000, "publicPath": "/dist/" } }
If you don't understand node-config In other words, you only need to know the port and host at the beginning, which determines the running path of your analog interface, and other direct use is enough.
After configuration, open the command line, go to the MongoDB root directory, run the Mongod server, and then run the program to use the interface.
$npm run dev
If it's just a small project, you can also use Charles to simulate the data interface. For specific use, you can enter Charles Read documents on the official website