url-shortening abstraction that uses google's url-shortener api
npm install short-url
Shorten a url
var url = require('short-url');
url.shorten('http://www.google.com', function(err, url) {
console.log(url); // http://goo.gl/fbsS
});Expand a shortened url
url.get('http://goo.gl/fbsS', function(err, url) {
console.log(url); // http://www.google.com
});urlexpanded urlcallback(err, url)callback containing shortened url
urlshortened urlcallbacker(err, url)callback containing expanded url