API mock plugin for whistle
npm install whistle.mockyaA rule-based API Data Mock plugin built on whistle.
``bash`
npm i -g whistle
w2 start
`bash`
w2 install whistle.mockya
Use tools like SwitchyOmega to proxy your website to whistle
`bash
[your_api_prefix] mockya://[mockya_collection_id]

$3
Visit http://localhost:8899/whistle.mockya (replace port with your own one) and install as PWA (recommended)

Features
$3

$3

$3
!Kapture 2024-03-18 at 20 17 42
$3
You can compose your mock data in both JSON5 and JavaScript, along with Mock.js syntax.


$3
Useful when you need to test things like loading state UI.
!Kapture 2024-03-18 at 20 32 38
$3
MockYa has special 'command' syntax to encode specific value in json.
`javascript
// append '>[command]' to some field
{ "key>[command]": xxx }// for example
{ "data>encode": { "a": 1 } }
// will return
{ "data": "{\"a\":1}" }
`!Kapture 2024-03-18 at 20 41 53
Currently support:
| Command | Description |
| ------- | ------------------------------------------ |
| encode | use
JSON.stringify` to encode field value |