Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




Note
titleContent Freeze

As of July 25th, 2023, there is a content freeze on this page.

Info

In PJS 6.0, you can debug low-code using the Designer IDE. This tip documents a different way to debug a low-code module, by "converting" it to "real" PJS code, so that you can see all the details in the PJS code generated from the low-code JSON specs. It's also a good way to learn "when I use a plugin, what does that plugin do behind the scenes, what actual 'real' PJS code does it run?".

...

Code Block
languagejs
titlepjstips_04_2.js
function app(req, res) {
  
  // init these 2 objects that would normally be done when a low-code module is called
  var input = {};
  var output = {};

  // set input data
  input.custno = 1234;

  // start of code converted from low-code module in step (5) above --------------------------
  // Consume REST service
  var _data = pjs.sendRequesthttpRequest({
    method: "POST",
    uri: `http://localhost:8081/run/pjstips/pjstips_02_3`,
    headers: {"Content-Type": "application/x-www-form-urlencoded"},
    body: {
    "custno": input["custno"]
    },
    json: true
  });
  var myres = _data;

  // Set Module output
  output["name"] = myres["name"];
  // end of code converted from low-code module in step (5) above ----------------------------
  
  // send back "output" from low-code module as JSON
  res.json(output);

}

exports.run = app;

...