diff --git a/What-is-rule-file-and-how-to-write-one.md b/What-is-rule-file-and-how-to-write-one.md index 5f3ce2f..cbfe660 100644 --- a/What-is-rule-file-and-how-to-write-one.md +++ b/What-is-rule-file-and-how-to-write-one.md @@ -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). \ No newline at end of file