Created
January 11, 2015 04:54
-
-
Save matmar10/6659ce1d67df8f79eda4 to your computer and use it in GitHub Desktop.
Short url generator specifying hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var short = require('short'); | |
short.connect('mongodb://localhost/short'); | |
short.generate({ | |
hash: 'google', | |
URL: 'http://www.google.com/' | |
}).then(function(shortUrlDoc) { | |
// this should be `google`, but it's still randomly generated | |
console.log(shortUrlDoc.hash); | |
}, function (err) { | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment