In my methods.JS file there have a function called addNedData()
here payload is giving proper output after creating the data.
methods.addNewData = (req, res, modelName, body ) =>{
modelName.create({
id: body.id,
title : body.title,
}).then((payload) => {
payload.success = true
return payload
}).catch(err => {
err.success = false
return err
})
}
from my controller file I am calling the function like this. the function is being called and executing also but in response value it is not returning any data..
exports.createCampaign = async (req, res) => {
let body = req.body
let response= await Methods.addNewData(req, res, Campaign, body)
console.log(response)
}
error is response is undefine..