Hiproxy supplied a mechanism of developing plugins. It’s simple that you need just develop a plugin and install it to global. Hiproxy should look for and load all plugins while it starts.
If you want to develop a plugin,
hiproxy-plugin-example is a good demo which you can find at https://github.com/hiproxy/hiproxy-plugin-example. This is a entire plugin demo, you can start your own pluign base on the demo.
A plugin is a common npm module. You do not need to install hiproxy as a dependency.
Three condition should be satisfied before a module becomes a hiproxy pluign:
- It must be a standalone npm module which export only one object with three properties
hiproxyCLI. Each element in the array should be a command configuration. See Command Configuration for details.
<Array>, extends rewrite directive of
hiproxy. Each element in the array should be a directive configuration. See Rewrite Directive for details.
<Array>, extends page router of
hiproxy. Each element in the array should be a route configuration.See Page Route Configuration for details.
Plugin module must be installed to global
Plugin name should use
You can publish a plugin into npm while it’s completed with development and testing.
The publish process is the same as publishing other npm module, since the a plugin of hiproxy is jsut a common npm module which follows given rules.
Hiproxy look for plugins which has
hiproxy-plugiin- as prefix and installed in the directory described by
npm root -g, so that hiproxy cannot find new developing pluigns.
npm link can create a symbol link of a plugin so that you can debug it while it’s in development. See npm link of npm document for details.