README
snowdrift
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"
}