easy-mock /easy-mock
A persistent service that generates mock data quickly and provids visualization view.
★ 8,948⑂ 1,323👁 221⑃ 58● 429▤ 12
+0
Daily
8,948
stars
1,323
forks
221
watchers
58
prs
429
issues
12
releases
README
Thanks to Souche Inc. which provides the server to hold an online service.
Links
- 简体中文介绍
- Online Manual
- Easy Mock CLI - A command line
tool to generate an api.js file quickly based on Easy Mock.
Introduction
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.
Features
- Support API proxying
- Convenient shortcuts
- Support Collaborative editing
- Support team project
- Support RESTful
- Support Swagger | OpenAPI Specification (1.2 & 2.0 & 3.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
Quick Start
Before starting, we assume that you're already have installed
Node.js (v8.x, ~~v10.x is not supported~~) & MongoDB (= v3.4) & Redis(= v4.0).
Installation
shell
$ git clone https://github.com/easy-mock/easy-mock.git
$ cd easy-mock && npm install
Configuration
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.
js
{
"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, e.g."5a4495e16ef711102113e500"
"ips": [] // ip, e.g. "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 server to enable LDAP login. e.g. "ldap://localhost:389" or "ldaps://localhost:389"(use SSL)
"bindDN": "", // Username,e.g. "cn=admin,dc=example,dc=com"
"password": "",
"filter": {
"base": "", // Base where we can search for users,e.g. "dc=example,dc=com"
"attributeName": "" // e.g. "mail" or "email" etc.
}
},
"fe": {
"copyright": "",
"storageNamespace": "easy-mock_",
"timeout": 25000,
"publicPath": "/dist/"
}
}
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 run build command
to adapTop issues
#47有在公司内网部署的同学请将公司信息在此回复一下哈106 comments · 2017-09-12#269部署失败问题反馈26 comments · 2019-01-03#258nginx反向代理内部报404,附配置截图(nginx 404)14 comments · 2018-12-14#344官网挂了吗???9 comments · 2019-09-09#336Why can't the website open today?9 comments · 2019-08-02#357部署到服务器时无法使用host: 0.0.0.08 comments · 2019-09-20#441公司内网部署,很多网址被屏蔽导致无法访问,需要如何解决7 comments · 2020-12-14#372现在是官网能打开,安全证书失效了,接口无法请求,这是要弃用了么?都没有个声明什么的7 comments · 2019-10-30
Latest release
v1.6.0 v1.6.0 2018-05-24Bug Fixes - 改善 Swagger 同步失败时的提示信息,144 New Features - 接口数据编辑器支持快捷键保存(win: 'Ctrl-S', mac: 'Command-S'),139 - redis 支持更多配置项,157 - 支持 LDAP 登录,138