apimock-rs 4.7.2 → 4.8.0
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 +16 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,15 +25,7 @@ All you have to do to start up is just use folders and JSON without any config s
|
|
|
25
25
|
- 🌬️ Fast to boot, light on memory.
|
|
26
26
|
- 🪄 File-based and rule-based matching. Scripting supported.
|
|
27
27
|
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
- The backend is not ready yet.
|
|
31
|
-
- You need stable API responses for UI testing.
|
|
32
|
-
- You want offline development.
|
|
33
|
-
- CI tests require a predictable API.
|
|
34
|
-
- Your mock data is becoming large.
|
|
35
|
-
|
|
36
|
-
### Handles real project scale
|
|
28
|
+
### `apimock-rs` handles real project scale
|
|
37
29
|
|
|
38
30
|
As your project grows, your mock API grows, too. Large mock datasets often cause problems:
|
|
39
31
|
|
|
@@ -42,6 +34,16 @@ As your project grows, your mock API grows, too. Large mock datasets often cause
|
|
|
42
34
|
- Crashes during UI testing
|
|
43
35
|
- Unstable CI runs
|
|
44
36
|
|
|
37
|
+
### When to use ?
|
|
38
|
+
|
|
39
|
+
- The backend is not ready yet.
|
|
40
|
+
- You need stable API responses for UI testing.
|
|
41
|
+
- You want offline development.
|
|
42
|
+
- CI tests require a predictable API.
|
|
43
|
+
- Your mock data is becoming large.
|
|
44
|
+
|
|
45
|
+
### Performance
|
|
46
|
+
|
|
45
47
|
apimock-rs does not preload responses. Each response file is read only when a request arrives using non-blocking I/O. This keeps:
|
|
46
48
|
|
|
47
49
|
- Startup nearly instant
|
|
@@ -87,6 +89,11 @@ You now have a running REST endpoint.
|
|
|
87
89
|
| `npx apimock -p 4000` | Run with custom port. |
|
|
88
90
|
| `npx apimock -d tests/apimock-dyn-route` | Run with custom root dir on server response. |
|
|
89
91
|
| `npx apimock -c apimock.toml` | Run with config file giving rich features. Running `npx apimock --init` beforehand is required. |
|
|
92
|
+
| `npx apimock --init` | **Interactive setup.** Prompts for port / IP / fallback dir / whether to scaffold a rule-set file, middleware file, and TLS section, then writes `apimock.toml` (and optionally `apimock-rule-set.toml` / `apimock-middleware.rhai`) customised to your answers. |
|
|
93
|
+
| `npx apimock --init --yes` | Non-interactive setup: skip every prompt and write the same defaults 4.7.0 wrote (`127.0.0.1:3001`, rule-set file included, TLS commented out). Useful in CI or Docker builds. |
|
|
94
|
+
| `npx apimock --init --middleware` | Also scaffold `apimock-middleware.rhai`. Combines with `--yes`. |
|
|
95
|
+
|
|
96
|
+
When stdin is not a TTY (piped, CI, Docker build), `--init` silently falls back to defaults even without `--yes` — so existing non-interactive usage of 4.7.0 keeps working unchanged.
|
|
90
97
|
|
|
91
98
|
### Vite project integration
|
|
92
99
|
|
package/package.json
CHANGED