diff --git a/api/palette.js b/api/palette.js index cb7a7d5..e2bfd2a 100644 --- a/api/palette.js +++ b/api/palette.js @@ -38,7 +38,7 @@ module.exports = function (req, res) { c3: "", c4: "" }; - + var script = $('#jscode').next().html(); // Finds our string of data on the page @@ -46,7 +46,7 @@ module.exports = function (req, res) { var itemerIndex = script.search("itemer"); if (itemerIndex === -1) { - console.log(url + "didn't work."); + console.log(url + " didn't work."); url = Math.floor(Math.random() * 100000).toString(); getColorJson('http://colorhunt.co/c/' + url); return; @@ -80,4 +80,12 @@ module.exports = function (req, res) { // Generates first color code and initializes recursive function. var url = Math.floor(Math.random() * 100000).toString(); getColorJson('http://colorhunt.co/c/' + url); -}; \ No newline at end of file +}; + + + +function getRandom() { + return new Promise(res => { + request('http://colorhunt.co/c/random') + }); +} \ No newline at end of file