1. EasyMock data interface
1.1 what is EasyMock
Easy Mock is a visual service that can quickly generate simulation data. It is an online Mock service produced by Hangzhou big search car wireless team, which is extremely simple, efficient, visual and can quickly generate simulation data. Now easy Mock has built-in Mock JS, we can forge data more happily.
Official website: https://www.easy-mock.com/
file: https://www.easy-mock.com/docs
1.2 basic use of easymock
1.2.1 login or registration
visit https://www.easy-mock.com After, click start and enter the user name and password. If it does not exist, it will be registered automatically.
Note: there is no password retrieval function, please remember the password!
After successful login, jump to the following page:
1.2.2 create project
Lower right corner + icon to create project:
Create successful renderings:
1.2.3 interface configuration
-
Create an interface and click the item in the lower left corner.
-
Enter the project workbench page and click Create interface
-
In the left edit window, enter mock JS code. Method, Url, description and other information are defined on the right.
-
Write your own mock JS code
-
Select the request method, URL and description in the right window, and then click create
-
After creation, jump to the following page
1.2.4 interface test
-
Preview interface and copy interface address on the right side of the interface
-
Modify and clone interfaces and delete interfaces
2. EasyMokc local deployment
reference resources: https://mp.weixin.qq.com/s/hVHDIMZUerTiXTYgX0yIwQ
Download and install node.2
Install node js v8. X (Note: v10.x is not supported)
reference resources: https://github.com/easy-mock/easy-mock/blob/dev/README.zh-CN.md
2.1.1 download node
wget https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz
2.1.2 unzip the installation package
tar xf node-v8.11.1-linux-x64.tar.xz mv node-v8.11.1-linux-x64.tar.xz /usr/local/node
2.1.3 adding environmental variables
vi /etc/profile
Write the following:
export NODE_HOME=/usr/local/node export PATH=$NODE_HOME/bin:$PATH
Make it effective:
source /etc/profile ln -s /usr/local/node/bin/node /usr/bin/node ln -s /usr/local/node/bin/npm /usr/bin/npm ln -s /usr/local/node/bin/npx /usr/bin/npx
Check for successful installation:
node -v
2.2 installation of Monogodb
2.2.1 add yum source of Monogodb
vi /etc/yum.repos.d/mongodb-org-3.2.repo
Add the following:
[mongodb-org-3.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
Generate cache:
yum makecache
2.2.2 installation of monogodb
yum install -y mongodb-org-server
2.2.3 start monogodb
systemctl start mongod.service
2.2.4 check whether it starts normally
systemctl status mongod.service lsof -i:27017
2.3 installing Redis
3.3.1 installation of epel warehouse
yum install epel-release
2.3.2 installing Redis
yum install -y redis
2.3.3 start Redis
systemctl start redis.service
2.3.4 check whether it starts normally
systemctl status redis.service lsof -i:6379
2.4 local deployment EasyMock
2.4.1 download project code
git clone https://github.com/easy-mock/easy-mock.git
2.4.2 installation project dependency
cd easy-mock npm install
Project construction
npm run build
2.4.4 start up project
npm run start
2.4.5 check whether it starts normally
lsof -i:7300
3. Domain name resolution and SSL certificate configuration
3.1 domain name resolution
After the corresponding domain name supplier purchases the domain name, real name authentication and filing, it can be parsed and used normally.
3.2 SSL certificate
certbot is recommended!!!
To install certbot on Nginx on CentOS7: https://certbot.eff.org/lets-encrypt/centosrhel7-nginx