Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wolfsilver/whistle.xxtpl
whistle自适应响应json/jsonp插件
https://github.com/wolfsilver/whistle.xxtpl
Last synced: about 1 month ago
JSON representation
whistle自适应响应json/jsonp插件
- Host: GitHub
- URL: https://github.com/wolfsilver/whistle.xxtpl
- Owner: wolfsilver
- License: mit
- Created: 2019-12-05T06:35:02.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T19:52:25.000Z (almost 3 years ago)
- Last Synced: 2023-12-26T05:02:52.494Z (11 months ago)
- Language: JavaScript
- Size: 128 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# whistle.xxtpl
自适应callback返回json/jsonp
匹配方式:
```js
pattern xxtpl://{res.json}
````res.json`示例
```json
{
"data": {
"value": 123
},
"msg": "success",
"ret": 0
}
```> 其中,`pattern` 表示匹配请求url的表达式,可以为域名(如:`www.test.com xxtpl://{res.json}`)、路径,通配符、正则表达式等,具体参见:[whistle的匹配模式](http://wproxy.org/whistle/pattern.html)。
## 安装
1. 首先需要安装最新版[whistle](https://github.com/avwo/whistle),如果你的机器已经安装了whistle,请确保whistle为最新版本:
- 安装及如何使用whistle参见[Github](https://github.com/avwo/whistle)
- 如何升级whistle参见[帮助文档](http://wproxy.org/whistle/update.html)。2. 安装xxtpl插件,执行npm全局安装即可:
```shell
npm i -g whistle.xxtpl
```> 如果是Linux或Mac,可能需要用 `sudo npm i -g whistle.xxtpl`,推荐使用[cnpm](https://github.com/cnpm/cnpm)或自己公司提供的npm镜像安装