node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

snowdrift

snowdrift

Alt text

This is a very simple url shortener.

Stores URLs in MongoDB.

Installation

npm install snowdrift -S

Setup & Usage

var snowdrift = require("snowdrift");
snowdrift.config(#mongodb_connection_url#, function(){
    console.log("ready to start shortening");
});

Shorten

store url and generate a unique key

snowdrift.shorten("http://apple.com", function(err, results){
    console.log(results);
});

Unshorten

retrieve url for unique key

snowdrift.unshorten("ortrw", function(err, results){
    console.log(results);
});
 

The Results

both methods return json containing key and url properties

 { 
    "key": "ortrw",
    "url": "http://apple.com" 
}