I started looking at IBM Cloud Functions (NodeJS runtime) and I was wondering if anyone had been able to debug a function on his local machine.
Suppose to have a simple NodeJs function which returns a json.
const md5 = require('spark-md5');
function myAction(params) {
// params contain the "rows" coming from Cloudant including the full documents
return {
entries: params.rows.map((row) => { return {
name: row.doc.name,
email: row.doc.email,
comment: row.doc.comment,
createdAt: row.doc.createdAt,
icon: (row.doc.email ? `https://secure.gravatar.com/avatar/${md5.hash(row.doc.email.trim().toLowerCase())}?s=64` : null)
}})
};
}
exports.main = myAction;
I would like to have breakpoints and step-by-step debug. How can I debug this function before deploying it on the IBM Cloud Functions? I really don't have an idea even on how I can pass inputs and see outputs.I'm used to use Postman for testing my backends but here I'm a bit confused and don't know where to start.