How can I return the output of node-fetch as a variable? I would like to be able to call this function and have it return the JSON object.
async function getbody(configType){
const response = fetch(getURL(configType), {
method:'GET',
headers: {
'Authorization' : `token ${GITHUB_TOKEN}`,
'Accept' : `application/vnd.github.VERSION.raw+json`,
'Content-Type': `application/json`
}})
.then(res => res.json() )
.then(data => obj = data)
.catch((err) => console.log(err));
module.exports = async () => {
getBody(configType)
}