Updated What is rule file and how to write one (markdown)

Otto Mao 2015-03-16 14:59:19 +08:00
parent 74b75cec49
commit dd453b203f

@ -104,6 +104,17 @@ To invoke a rule file
* in shell ``anyproxy --rule /path/to/ruleFile.js``
To invoke a third-party node module in rule file
-------------------------
* ``` anyproxy install ``` is designed for quickly invoking third-party modules in rule file
* for example, if you want to use *underscore* for supporting rules development, just use ``` anyproxy install underscore ```...
* ... and require it in rule file
```
var base = require("path").join(process.env.NODE_PATH,'anyproxy','node_modules');
var underscore = require(path.join(base,'underscore'));
```
Samples
-------------------------
* Samples could be found at [https://github.com/alibaba/anyproxy/tree/master/rule_sample](https://github.com/alibaba/anyproxy/tree/master/rule_sample).