I'm using the following code to execute a rest API using Curl with Node.JS. It is working on my local machine.
...
...
var child_process = require('child_process');
function runCmd(cmd)
{
var resp = child_process.execSync(cmd);
var result = resp.toString('UTF8');
return result;
}
var cmd = "curl -u userx:passx -X POST --data @test.json -H 'Content-Type: application/json' https://mysite.atlassian.net/rest/api/2/issue/";
var result = runCmd(cmd);
...
...
But after uploading to server, I'm getting the following error
/home/ubuntu/PMPBuild/jiraIssue.js:76
var resp = child_process.execSync(cmd);
^
TypeError: Object function (command /*, options, callback */) {
var file, args, options, callback;
node-curl
library if you can't get this working, just let me know