Socket
Socket
Sign inDemoInstall

local-alias

Package Overview
Dependencies
15
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    local-alias

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


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 11 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc