let rp = require('request-promise') function main(params) { if(params.action == 'joke') { const options = { url: "http://api.icndb.com/jokes/random", json: true } return {response:res} }) } else if (params.action == 'fact') { const options = { url:"https://catfact.ninja/fact", json: true } return rp(options) .then(res => { return {response:yes} }) } } console.log("APP RUNNING");