glg-url
A simple URL shortener intended to be a drop in module replacement for Bit.ly or called as a simple service in Starphleet.
Example Usage
This can be used as an NPM module. The backend makes liberal use of the KV Store - so, as long as you have access to the KV Store you're golden. You will need to setup a few environment variables for the KV Store which can be found here. If you intend to use different values than the server make sure you know what you are doing.
A method has been exposed that is (hopefully) a drop-in replacement for the node bit.ly module.
For Example:
var url = require('glg-url');
var _longUrl = "http://games.disney.com/101-dalmatians-match-and-dash";
url.shorten(_longUrl,function(err,bitlyCompatibleResult) {
if (err) {
throw new Error(err);
}
console.log("Short Url:",bitlyCompatibleResult.data.url);
// Short Url: http://glg.link/dkwe
});
Using from the command line
There is an included command line tool. If you do not run with an "always on" dev environment file you will need to source a file with the appropriate KV Store variables. The command line version will error out without the environment variables set.
For Example:
➜ ~ npm install -g glg-url
➜ ~ source "${HOME}/.devenv"
➜ ~ glgurl -u "https://www.google.com"
[Info] http://glg.link/XmP6
Documentation
You can find REST documentation here
You will find NPM documentation here