Skip to content

Using in Node.js

Joel Latino edited this page Jul 16, 2013 · 2 revisions

Using CDA.js on Node.Js

##Installation You need installed node.js and after installation you just need run the following command:

$ npm install cdajs

##Sample And you just need import using require method. Check the following example:

var cda = require("cda.js");

exports.index = function(req, res) {
  var obj = new cda.CDA({
    url: "http://localhost:8080/pentaho/content/cda/",
    username: "joe",
    password: "password",
    error: function(error) {
      console.log("Error: " + error);
      return;
    }
  });
  obj.doQuery(function(xhr) {
    res.send("Result Set: " + xhr.resultset);
  }, {
    params: {
      dataAccessId: 1,
      outputIndexId: 1,
      pageSize: 0,
      pageStart: 0,
      path: "%2Fplugin-samples%2Fcda%2Fcdafiles%2Fscripting.cda",
      sortBy: ""
    }
  });

};

You can find a example here. And you only need run this command:

$ node app.js
Clone this wiki locally