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

airfield

v0.3.2

Published

Redirection proxy for directing remote hosts to local services. Compatible with unix-like systems (macOS, Linux, etc.).

Downloads

8

Readme

airfield

Redirection proxy for directing remote hosts to local services. Compatible with unix-like systems (macOS, Linux, etc.).

Installation

npm install -g airfield

Setup

In any project folder, setup an airfield config file as airfield.config.js. Here's a sample:

module.exports = {
    origin: 'some-remote-site.com', // capture traffic intended for this domain
    destination: 'localhost:1234', // and push it to this domain instead
    useSSL: false,
    onStartup: () => {
        console.log('it works! :)');
    }
};

Usage

In the project folder where you've got your airfield.config.js, simply run airfield (although you may need to run sudo airfield, depending on how your system's permissions are configured. If so, airfield will let you know.).

> airfield

-------------------------------------------------------------------------------------------------------------------------------------

       d8888 8888888 8888888b.  8888888888 8888888 8888888888 888      8888888b.
      d88888   888   888   Y88b 888          888   888        888      888  "Y88b
     d88P888   888   888    888 888          888   888        888      888    888
    d88P 888   888   888   d88P 8888888      888   8888888    888      888    888
   d88P  888   888   8888888P"  888          888   888        888      888    888
  d88P   888   888   888 T88b   888          888   888        888      888    888
 d8888888888   888   888  T88b  888          888   888        888      888  .d88P
d88P     888 8888888 888   T88b 888        8888888 8888888888 88888888 8888888P"

-------------------------------------------------------------------------------------------------------------------------------------
 ✓ OK:      Hosts file (/etc/hosts) is properly configured:
 >>>>         {
 ::::           "source": "some-remote-site.com",
 ::::           "destination": "127.0.0.1"
 ::::         }
 → INFO:    Starting redirect server. . .
 ✓ OK:      Redirection http server listening on :80
 ✓ OK:      Redirection https server listening on :443
 ✓ OK:      it works! :)

Troubleshooting

|Issue|Possible Fix| |:--|:--| |I get a message that says "your hosts file ain't setup right" or something|Follow the instructions given to properly configure your hosts file to handle your desired given hostname. If you've updated the hosts file and airfield still doesn't work, try restarting your computer machine. | |I get an error that says "EACCESS", then some cryptic node garbage.|Run the app as root/super user to host on ports below 1024 (including 80 and 443 as needed here).| |I get an error that says "EADDRINUSE", then some cryptic node garbage.|Make sure there's no other apps running on your port 80 or 443 (the default web ports for http and https, respectively). Google this if you aren't sure how to check.| |The redirect doesn't complete; I land on a webpage but it says the SSL certificate is invalid.|Add an exception in your browser for the invalid certificate. The cert used by airfield is self-signed, and lives inside /airfield/ssl. Trusting the local cert is necessary since we need to catch local SSL traffic (at https://...).| |Something else is wrong|Well, email austin or something.|

How it works

Once your /etc/hosts file is configured properly to treat requests to "example.com" (or whatever) to your local machine (127.0.0.1), airfield runs a server at port 80/443, which intercepts the redirected page URL. The token part of the querystring along with the full post-hostname path is passed along to the specified destination host.