mock-service-cli 3.1.5 → 3.1.6

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 CHANGED
@@ -102,10 +102,16 @@ This will install `mock-service-cli` globally so that it may be run from the com
102
102
 
103
103
  `mock-service-cli -S`
104
104
 
105
- 6. Start static web server for SPA, and optionally specify public path and port.
106
- `mock-service-cli -D ../react-best-practice/dist [-b '/redbridge/'] [-P 9090]`
105
+ 6. Only Used as api server for test on browser console or api request tools.
106
+ > must specified server directory which can be empty but not includes index.html file, and also need config API proxy.
107
107
 
108
- 7. Enable Proxy base on above item 6. support accept js file、json file、cli arguments string
108
+ `mock-service-cli -D server -O '/api/apaas|http://192.168.0.105:60700'`
109
+
110
+ 7. Start static web server for SPA, and optionally specify public path and port.
111
+
112
+ `mock-service-cli -D ../react-best-practice/dist [-b '/redbridge/'] [-P 9090]`
113
+
114
+ 8. Enable Proxy base on above item 7. support accept js file、json file、cli arguments string
109
115
 
110
116
  - cli arguments string
111
117
 
package/lib/mockServer.js CHANGED
@@ -221,10 +221,12 @@ if (process.env.WEB_ROOT) {
221
221
  webApp.use(webPublicPath, express.static(process.env.WEB_ROOT)); // 将dist目录下所有文件作为静态文件来管理
222
222
  const defaultStaticEntry = `${process.env.WEB_ROOT}/index.html`;
223
223
  if (fs.existsSync(defaultStaticEntry)) {
224
+ // Used as static HTTP server for SPA
224
225
  webApp.get('*', (req, res) => {
225
226
  res.sendFile(defaultStaticEntry);
226
227
  });
227
228
  } else {
229
+ // Used as api server for test on browser console or api request tools
228
230
  webApp.use(webPublicPath, (req, res) => {
229
231
  res.status(200)
230
232
  .send(`Hi, welcome to web server entrance ui, you can test http proxy on browser console or api request tools. Examples as follows:<br />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mock-service-cli",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "🦅 Local mock server",
5
5
  "main": "./lib/mockServer.js",
6
6
  "bin": {