Return call not giving results as expected

Hi,
I need a help. I created a backend/aModule.jsw to add a database operation which i need to call from my front end code. This is what i did:

aModule.jsw

export function riskProfData() {
wixData.query("Items").find().then( (results) => {
var items = results.items;
//console.log(items[idx].answer3,items[idx].answer4,items[idx].longDescription, items[idx].shortDescription, items[idx].title);
var result = new Array(5);
result[0] = items[0].answer3;
result[1] = items[0].answer4;
result[2] = items[0].longDescription;
result[3] = items[0].shortDescription;
result[4] = items[0].title;
return result;
} ) .catch((onRejected) => {
let errMsg = onRejected;
console.log("Error Msg from Database", errMsg)
in return null;
});
}

in the Front end. items(dynamic Page) is call:

import {riskProfData} from 'backend/aModule';
$w.onReady( () => {
//
riskProfData().then(results => {
console.log(results[0], results[1]);
});
..
..

This above code is not working as the call to riskPRofData is not returning anything. When i put a Console.log before return in riskProfData, i can see the contents present in the database. What mistake am i doing here?
I tried a wrapper Async/Await function to call riskProfData. Even that did not work.

Appreciate your help.

Add keyword ‘return’ before wixdata.query() i.e. return wixData.query().

You can see more about why you need the return here.
https://support.wix.com/en/article/corvid-web-modules-calling-server-side-code-from-the-front-end

Thanks Neeraj. It worked.

Thanks GOS. Appreciate reading the question and showing me this page.