mock-service-cli 3.1.6 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/lib/mockServer.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
**简易轻量**、**B/S 架构**、**0 秒启动**的本地命令行 Mock 服务套件, 支持热更新,对于开发调试 mock 数据很实用,能提高前端开发者的开发效率。支持 `GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`OPTIONS`,`COPY`,`LINK`,`UNLINK`,`PURGE` 等常用请求类型,无需布署后端,可能是本地最好用的 Mock 工具之一。
|
|
16
16
|
|
|
17
|
+
特性功能:
|
|
18
|
+
|
|
19
|
+
- 支持统计 mock 的文件数量和 mock 请求数量
|
|
20
|
+
- 支持终端打开 mock 文件的所在位置
|
|
21
|
+
|
|
17
22
|
#### Mock Server - 本地 Mock 服务器
|
|
18
23
|
|
|
19
24
|
支持以下常见业务场景:
|
package/lib/mockServer.js
CHANGED
|
@@ -109,7 +109,7 @@ const composeRouteFromJsFile = function (file) {
|
|
|
109
109
|
colors.grey(`path ${String(++count).padStart(3, ' ')}: `),
|
|
110
110
|
colors.cyan(reqMethod.padEnd(8, ' ')),
|
|
111
111
|
colors.cyan(reqUrl),
|
|
112
|
-
colors.
|
|
112
|
+
colors.grey(typeof fileObject[item])
|
|
113
113
|
);
|
|
114
114
|
log.assert(typeof app[reqMethod] === 'function', colors.red(`${file}, ${reqMethod}`));
|
|
115
115
|
if (typeof fileObject[item] === 'function') {
|
|
@@ -154,7 +154,7 @@ const parseMockFiles = function (specialDir = '../mock') {
|
|
|
154
154
|
colors.grey(`path ${String(++count).padStart(3, ' ')}: `),
|
|
155
155
|
colors.cyan(method.padEnd(8, ' ')),
|
|
156
156
|
colors.cyan(apiUrl),
|
|
157
|
-
colors.
|
|
157
|
+
colors.grey(typeof fileObject[method])
|
|
158
158
|
);
|
|
159
159
|
log.assert(typeof app[method] === 'function', colors.red(`${filePath}, ${method}`));
|
|
160
160
|
app[method](apiUrl, function (req, res) {
|