Initial commit

This commit is contained in:
2020-08-14 17:18:53 +03:00
commit ff1d8db3e0
1084 changed files with 123333 additions and 0 deletions

25
server/httpsReq.js Normal file
View File

@@ -0,0 +1,25 @@
import https from "https";
export function httpsReq(url) {
return new Promise(resolve => {
https.get(url, (res) => {
res.setEncoding('utf8');
let data = '';
res.on('data', chunk => {
data += chunk;
});
res.on('end', () => {
try {
let jsonObj = JSON.parse(data);
resolve(jsonObj);
} catch (e) {
res.status(400).send('Invalid JSON string');
}
});
}).on('error', err => {
console.log('Error: ' + err.message);
});
});
}