# local-alias

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

Latest version **0.0.3** (published 2017-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install local-alias
pnpm add local-alias
yarn add local-alias
bun add local-alias
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-06-11 |
| First published | 2017-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Kuba Wolanin |
| Maintainers | kubawolanin |
| Keywords | nodejs, redirect, url, alias |

## Links

- npm: https://www.npmjs.com/package/local-alias
- Repository: https://github.com/kubawolanin/local-alias
- Homepage: https://github.com/kubawolanin/local-alias#readme
- Issues: https://github.com/kubawolanin/local-alias/issues
- npm.io page: https://npm.io/package/local-alias

## Dependencies (3)

- [connect](https://npm.io/package/connect.md) ^3.6.2
- [self-reload-json](https://npm.io/package/self-reload-json.md) ^0.3.0
- [connect-redirection](https://npm.io/package/connect-redirection.md) 0.0.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.3 (latest) — 2017-06-11
- 0.0.2 — 2017-06-11
- 0.0.1 — 2017-06-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](https://thepihut.com/blogs/raspberry-pi-tutorials/19668676-renaming-your-raspberry-pi-the-hostname).


## 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`](http://npmjs.com/package/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
```

---
_Source: https://npm.io/package/local-alias · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
