snowdrift

a very simple url shortener

Usage no npm install needed!

<script type="module">
  import snowdrift from 'https://cdn.skypack.dev/snowdrift';
</script>

README

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