I want an export quick
function. How can I do that?
Here’s my main code,
const axios = require('axios')
const quick = async (slug) => {
const res = await axios.post('https://localhost:3000/api/read', {
slug: slug
})
return res.data.data
}
module.exports = quick
Here is what I encounter when importing the function into another file,
const quick = require('./main.js')
console.log(quick('slug'))
Output
Promise { <pending> }
I want to get the proper output while exporting and importing other functions.