json-api-mocker 1.0.2 → 1.0.3

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.
Files changed (3) hide show
  1. package/README.ch.md +31 -0
  2. package/README.md +31 -0
  3. package/package.json +1 -1
package/README.ch.md CHANGED
@@ -70,12 +70,43 @@ pnpm add json-api-mocker
70
70
 
71
71
  ### 2. 启动服务器
72
72
 
73
+ 有多种方式可以启动 Mock 服务器:
74
+
73
75
  ```bash
76
+ # 方式一:使用 npx(推荐)
74
77
  npx json-api-mocker
78
+
79
+ # 方式二:使用 npx 并指定配置文件
80
+ npx json-api-mocker ./custom-config.json
81
+
82
+ # 方式三:如果全局安装了包
83
+ json-api-mocker
84
+
85
+ # 方式四:如果作为项目依赖安装
86
+ # 在 package.json 的 scripts 中添加:
87
+ {
88
+ "scripts": {
89
+ "mock": "json-api-mocker"
90
+ }
91
+ }
92
+ # 然后运行:
93
+ npm run mock
75
94
  ```
76
95
 
77
96
  现在你的 Mock 服务器已经在 `http://localhost:8080` 运行了!
78
97
 
98
+ 你会看到类似这样的输出:
99
+ ```bash
100
+ Mock 服务器已启动:
101
+ - 地址:http://localhost:8080
102
+ - 基础路径:/api
103
+ 可用的接口:
104
+ GET http://localhost:8080/api/users
105
+ POST http://localhost:8080/api/users
106
+ PUT http://localhost:8080/api/users/:id
107
+ DELETE http://localhost:8080/api/users/:id
108
+ ```
109
+
79
110
  ## 📖 配置指南
80
111
 
81
112
  ### 服务器配置
package/README.md CHANGED
@@ -70,12 +70,43 @@ Create a `data.json` file in your project root:
70
70
 
71
71
  ### 2. Start the Server
72
72
 
73
+ There are several ways to start the mock server:
74
+
73
75
  ```bash
76
+ # Method 1: Using npx (Recommended)
74
77
  npx json-api-mocker
78
+
79
+ # Method 2: Using npx with a custom config file
80
+ npx json-api-mocker ./custom-config.json
81
+
82
+ # Method 3: If installed globally
83
+ json-api-mocker
84
+
85
+ # Method 4: If installed as a project dependency
86
+ # Add this to your package.json scripts:
87
+ {
88
+ "scripts": {
89
+ "mock": "json-api-mocker"
90
+ }
91
+ }
92
+ # Then run:
93
+ npm run mock
75
94
  ```
76
95
 
77
96
  Now your mock server is running at `http://localhost:8080`!
78
97
 
98
+ You'll see output like this:
99
+ ```bash
100
+ Mock Server is running:
101
+ - Address: http://localhost:8080
102
+ - Base Path: /api
103
+ Available APIs:
104
+ GET http://localhost:8080/api/users
105
+ POST http://localhost:8080/api/users
106
+ PUT http://localhost:8080/api/users/:id
107
+ DELETE http://localhost:8080/api/users/:id
108
+ ```
109
+
79
110
  ## 📖 Configuration Guide
80
111
 
81
112
  ### Server Configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-api-mocker",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "一个基于 JSON 配置的 Mock 服务器",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",