Thanks to Souche Inc. which provides the server to hold an online service.
- 简体中文介绍
- Online Manual
- Easy Mock CLI - A command line tool to generate an api.js file quickly based on Easy Mock.
If you're unable to deploy an Easy Mock service by yourself, the online service is recommended.
Easy Mock is a persistent service that generates mock data quickly and provids visualization view.
- Support API proxying
- Convenient shortcuts
- Support Collaborative editing
- Support team project
- Support RESTful
- Support Swagger 1.2 & 2.0
- Create project quickly based on Swagger
- Support displaying parameters and the return value
- Support displaying class model
- More flexible and extensible in response data
- Support for custom response configuration (example: status/headers/cookies)
- Use Mock.js schema
- Support restc to preview API
Before starting, we assume that you're already have installed Node.js (>= v7.4) and MongoDB (>= v3.4).
$ git clone https://github.com/easy-mock/easy-mock.git
$ cd easy-mock && npm install
Find config/default.json or create config/local.json to overwrite some configuration.
Easy Mock will load different configuration files according to your environment. Reference to node-config to get more information because Easy Mock uses node-config as its configuration module.
{
"db": "mongodb://localhost/{DATABASE-NAME}",
"unsplashClientId": "Background, see section below. (optional)",
"jwt": {
"secret": "shared-secret"
},
"fe": {
"publicPath": "/dist/",
"APIPrefix": "http://127.0.0.1:7300/api",
"uploadAPI": "Your own avatar uploading API uri",
"storageNamespace": "cookies & localStorage namespace"
}
}
Note:
- The default value of
publicPath
is'/dist/'
. You can replace it to your own CDN if necessary. - If you changed some configuration of
fe
, you should runbuild
command to adapt that changes.
Background:
Easy Mock supports two background service, Unsplash and Bing.
If you leave unsplashClientId
blank, the background will be provided by Bing.
$ npm run dev
# Visit http://127.0.0.1:7300
# Build front-end assets
$ npm run build
# Run Easy Mock as production environment (You should run `build` first)
$ npm run start
# Run unit test
$ npm run test
# Test lint
$ npm run lint
Please configure your configuration files before this step.
We're recommending you to use PM2 as your daemon process.
$ [sudo] npm install pm2 -g
You should run
build
before this step.
$ NODE_ENV=production pm2 start app.js
If you deploy Easy Mock by yourself, you should replace APIPrefix
to your own
server uri. eg:
Assume your server location is http://example.com, the APIPrefix
should be
http://example.com/api.
Refer to Release and you'll get all the releases and theirs changelog.
Easy Mock is now maintained by Mobi-Architecture team of Souche Inc. If you have any question about this project, you're welcome to post Issues or make some Pull Requests. Before contributing, we think you'd better read the contributing guide.
You may make some real-time feedback via QQ group.
QQ is the most popular IM software in China and you can get it downloaded via http://en.qq.com/.
The QQ group number is 595325417, and here's the QR code of the group:
If you deployed Easy Mock in your own server, please tell us
- Souche inc | 大搜车
- Ruff
- Qiniu | 七牛
- Head Spring | 恒达时讯
- Digital Union | 数字联盟
- CityTogo | 兔狗家装
- Mistong | 铭师堂
- Tuotuo Internet | 妥妥网络
- Straight flush | 同花顺
- 360 Enterprise Security | 360企业安全集团
- MeiTuan | 美团网
chuangker |
XadillaX |
ostoc |