url-shortener
Version:
Spawn up a simple webserver to act as a URL shortener
59 lines (43 loc) • 1.01 kB
Markdown
url-shortener
=============
Spawn up a simple webserver to act as a URL shortener
Usage
-----
$ url-shortener
[] server listening on http://localhost:8090
{ github: 'https://github.com', paste: 'http://pastebin.com' }
[] 127.0.0.1 GET 200 / (2ms)
[] 127.0.0.1 GET 301 /paste (1ms)
$ curl -s localhost:8090 | json
{
"paste": "http://www.pastebin.com",
"github": "https://github.com"
}
$ curl -I localhost:8090/paste
HTTP/1.1 301 Moved Permanently
Location: http://www.pastebin.com
Connection: keep-alive
Config
------
pass the config file name as the first argument
``` json
{
"host": "localhost",
"port": 8090,
"gid": null,
"uid": null,
"urls": {
"paste": "http://www.pastebin.com",
"github": "https://github.com"
}
}
```
Install
-------
npm install -g url-shortener
License
-------
MIT Licensed