Skip to content

internetsadboy/short-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

short-url

url-shortening abstraction that uses google's url-shortener api

Installation

npm install short-url

Usage

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
});

API

shorten(url, callback)

  • url expanded url
  • callback(err, url) callback containing shortened url

get(url, callback)

  • url shortened url
  • callbacker(err, url) callback containing expanded url

About

google url-shortener

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •