mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
25 lines
617 B
JavaScript
25 lines
617 B
JavaScript
const https = require('https');
|
|
const logger = require('myLogger.js');
|
|
|
|
function request(options) {
|
|
return new Promise ((resolve, reject) => {
|
|
const request = https.get(options);
|
|
request.on("response", response => {
|
|
var data = ''
|
|
response.on("data", function(chunk) {
|
|
data += chunk
|
|
});
|
|
response.on("end", function(){
|
|
resolve(data);
|
|
});
|
|
});
|
|
request.on("error", error => {
|
|
logger("ERROR", error)
|
|
resolve(error);
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
request
|
|
} |