How can I save the data fetched from an API in Node.js´ global variable?

function request2API(option){
    const XMLHttpRequest = require('xhr2');//Cargar módulo para solicitudes xhr2
const request = new XMLHttpRequest();
request.open('GET',  urlStart + ChList[option].videosList + keyPrefix + key);
request.send();
request.onload = ()=> {
    if(request.status === 200){
        const response = JSON.parse(request.response);
        console.log(response) //At this point the Object respond exists
        return response;
    };
};
};

let indexChannel = inputFunction("n Pick an option ")
let fetchedData = request2API(indexChannel); //By this point it has died
console.log(fetchedData);

I’ve tried to assignt the fetched data to a variable as one would do in regular javascript for a browser but it’s not working.