Aobot
A development proxy tool like Charles but more powerful.
Install: npm install -g aobot
note: if it failed, try to use sudo.
Guide
To use aobot, you should create a file called aobot-conf.js
(specify an another file by using -f
option).
// aobot-conf.jsmodule { aobot; aobot; aobot; aobot}
CLI
Usage: aobot [options] Options: -V, --version output the version number -p, --project <directory> project directory -f, --file <file> config file -s, --ssl get ssl root certificate -i, --ip output local ip -h, --help output usage information
API
- enableSSL
- route
- service
- remote
- local
- path
- fis
- listen
enableSSL()
The default behavior of treating https is just transmiting the requests.
So, you should call this to enable https proxy.
Of course, you must download the root certificat following steps by aobot -s
.
route(options)
The route decides what kind of urls will be hijacked and which pipeline used for handling request.
options = // "http", "https", ignored means all protocol: type: 'string' required: false // an regex string, like "www.google.com", "google.com|facebook.com", ignored means all host: type: 'string' required: false // number, 8080, 3000, ignored means all port: type: 'number' required: false // match for the total url, eg: "/static" , ignored means all path: type: 'string' required: false
service
The service is a pipeline unit representing how to response with the corresponding route.
remote(options)
// just like the options in routeoptions = protocol: type: 'string' required: false host: type: 'string' required: false port: type: 'number' required: false path: type: 'string' required: false
local(options)
Directry served for request.
options = path: type: 'string' required: true
path(options)
Path replace using the javacript String.replace
options = from: type: 'string' required: true to: type: 'string' | 'function' required: true
listen(port)
The function called to listen port, only can be called once.
aobot // equal to aobotaobot // but, if you have multiple routesaobot... aobot... // it's better to useaobot