I recently forked cors-anywhere (more precisely, a cors-anywhere fork, cors-escape) and edited it, and it works exactly how I need it to! However, instead of running an http/https server that shows what I need, I want to make it into something like node-fetch (a module that requests the resource as cors-anywhere would like fetch). I know it has to do with these lines, but I am not sure what to do with them (and what to export as a module):
let server;
if (options.httpsOptions) {
server = require('https').createServer(options.httpsOptions, requestHandler);
} else {
server = require('http').createServer(requestHandler);
}
How could I modify them to make and return a request instead? Thanks so much!