code: function nodeGet(url) {
    // return new pending promise
    return new Promise(function (resolve, reject) {
      // select http or https module, depending on reqested url
      var lib = url.startsWith("https") ? require("https") : require("http");
      var request = lib.get(url, function (response) {
        // handle http errors
        if (response.statusCode < 200 || response.statusCode > 299) {
          reject(new Error("Failed to load page, status code: " + response.statusCode));
        }
        // temporary data holder
        var body = [];
        // on every content chunk, push it to the data array
        response.on("data", function (chunk) {
          return body.push(chunk);
        });
        // we are done, resolve promise with those joined chunks
        response.on("end", function () {
          return resolve(body.join(""));
        });
      });
      // handle connection errors of the request
      request.on("error", function (err) {
        return reject(err);
      });
    });
  }
docs: thanks https://www.tomas-dvorak.cz/posts/nodejs-request-without-dependencies/