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

local-alias

v0.0.3

Published

Simple Node.js server for setting up local aliases for various URLs

Downloads

11

Readme

Local alias

Simple Node.js server app that allows you to create short aliases for any URL provided.

Installation

npm install -g local-alias

You can install it on any machine running Node.js. I'm serving it from RaspberryPI 3. Note that this tool makes sense if your hostname is short (e.g. home / http://home/) and the server runs at default 80 port. Therefore please make sure that 80 port is available on your machine.

You can always change the port value in the config.json file.

Here's how to change your hostname on RPi.

Configuration

cd $(npm root -g)/local-alias
nano config.json

Configure your config.json file providing an alias name as a key and URL as the value.

{
    "port": 80,
    "aliases": {
        "oh": "http://openhabianpi:8080/start/index",
        "github": "https://github.com/issues/mentioned"
    }
}

This way you have a quick access to those URLs by simply typing

home/github

in your browser.

You can also link aliases to other aliases (with > prefix) if you don't want to duplicate URLs.

{
    "port": 80,
    "aliases": {
        "forum": "https://community.openhab.org",
        "community": ">forum"
    }
}

You can also create simple URL wildcards with %s in the URL value:

{
    "aliases": {
        "binding": "http://docs.openhab.org/addons/bindings/%s/readme.html",
        "help": "http://docs.openhab.org/search?q=%s"
    }
}

And use it like this:

http://home/binding/airquality

http://home/help/whatever

Running

node local-alias

There's a possibility to run this as a service using forever. But before you do that, you'll need to make sure that you set right permissions to run server on 80 port.

On Debian/Ubuntu:

sudo apt-get install libcap2-bin
sudo setcap cap_net_bind_service=+ep `readlink -f \`which node\``

And then install and run forever

npm i -g forever
sudo forever start $(npm root -g)/local-alias