Versions Compared

Key

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

...

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;

...