Is it possible to return a response when call a function within another function?
I have following codes -
// Add Category
exports.saveCategory = async function(catData, callback){
try{
const images = await uploadImages(catData.files);
console.log(images); //nothing prints here
const save = await function(catData,images){
console.log('catdata');
return callback({status:200,message:'test'});
}
} catch (e) {
console.log(e);
}
}
function uploadImages(images) {
//some stuff
return images;
}
Expected output : I want to return name of uploaded images from uploadImages function and pass it to another function to save in database.