问题
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