npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aobot

v1.0.1

Published

A development proxy tool like Charles but more powerful.

Downloads

7

Readme

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.js
module.exports = function (aobot) {
    aobot.enableSSL();
    aobot.route({
        host: 'mysite.com',
    }).pipe('path', {
        from: '/proxy/(.*)',
        to: '/$1'
    }).pipe('local', {
        path: 'public'
    }).pipe('remote', {
        protocol: 'http',
        host: '10.6.131.79',
        port: 17419
    });

    aobot.route({
        host: 'mysite.com',
        path: '/static'
    }).pipe('local', {
        path: 'public'
    });

    aobot.listen(8888)
}

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 route
options = {
    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.route({}).pipe('remote', {}).listen(3000)

// equal to 
aobot.route({}).pipe('remote', {})
aobot.listen(30000)

// but, if you have multiple routes
aobot.route({
    host: 'google.com'
})...

aobot.route({
    host: 'gmail.com'
})...

// it's better to use
aobot.listen(3000)