Using node.js to fetch json data from jira using the jira-connector library not working when deployed in heroku

被刻印的时光 ゝ 提交于 2019-12-25 03:54:07

问题


As mentioned above, I fetched data and displayed it in a get request to retrieve data from server and display it in JSON format, I used this library https://www.npmjs.com/package/jira-connector, whenever i locally fetch data it works and displays the JSON data but when I deploy it in Heroku web server (example.herokuapp.com), the fetched data is not displayed at example.herokuapp.com/jiraWIPCRs (empty data / null) and in http://localhost:2000/jiraWIPCRs the data is displayed.

const base64 = require('base-64');
const JiraClient = require('jira-connector');

const jira = new JiraClient( {
host: '***********************',
protocol: 'http',
basic_auth: {
    base64: base64.encode("username:password")
},
port: ****

});

//endpoint
app.get('/jiraWIPCRs', (req, res) =>{

jira.search.search({
    jql: ' "ECR #" != NULL AND "status" != Accepted AND "status" != Canceled AND "type" = "Change Request" AND "project"="Customer Support"',
    maxResults: 5000
}, function(error, issue) {
    res.send(issue);
});

});

const port = process.env.PORT || 2000;

app.listen(port, () => {
console.log("App is running on port " + port);
});

来源:https://stackoverflow.com/questions/53068278/using-node-js-to-fetch-json-data-from-jira-using-the-jira-connector-library-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!