Skip to content

Instantly share code, notes, and snippets.

@matmar10
Created January 11, 2015 04:54
Show Gist options
  • Save matmar10/6659ce1d67df8f79eda4 to your computer and use it in GitHub Desktop.
Save matmar10/6659ce1d67df8f79eda4 to your computer and use it in GitHub Desktop.
Short url generator specifying hash
'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