I got this function
module.exports.usersdb = async function (req, res) {
const arr = ["apple", "banana", "orange"];
const encodearray = arr.map(data=> _token.signToken(data));
console.log(encodearray);
}
but the output is a promise object like: "Promise: {result}"
How can i get it as a string?
this is the signtoken function which is exported
exports.signToken = function (data) {
return new Promise((resolve, reject) => {
try {
const token = jwt.sign(data, _sign, algorithm);
resolve(token)
} catch (err) {
return reject("An error has occurred " + err)
}
})
}