I have the following code:
async function myPromiseFunction() {
return "test";
};
function processComment(params) {
(async () => {
console.log(await myPromiseFunction());
})();
}
exports.main = processComment;
The only way to output HTML code to the DOM in this case (serverless function), is through return {"body": "<h1>Test</h1>"}.
The problem is, if I put return {"body": "<h1>Test</h1>"} inside of the Async, it does not work and just does not return anything - it only works inside the processComment function whilst it is outside an async.
How can I replace console.log(await myPromiseFunction()); with return {"body": await myPromiseFunction())?
I can only console.log the value, but how can I return it so that it gets outputted as HTML?
returntoprocessComment()method like this?function processComment(params) { return (async () => { await myPromiseFunction(); })();}return {"body":val}-return {"body": (async () => { await myPromiseFunction(); })()}?