Files

42 lines
1.2 KiB
JavaScript

const https = require('https');
const http = require('http');
function fetch(url) {
return new Promise(resolve => {
const mod = url.startsWith('https') ? https : http;
mod.get(url, res => {
let d = '';
res.on('data', c => d += c);
res.on('end', () => resolve({ status: res.statusCode, headers: res.headers, body: d }));
}).on('error', err => resolve({ error: err.message }));
});
}
async function main() {
const urls = [
'https://gateway.ghaymah.systems',
'https://gateway.ghaymah.systems/health',
'https://gateway.ghaymah.systems/api',
'https://integrations.ghaymah.systems/api',
'https://integrations.ghaymah.systems/health',
'https://cli.ghaymah.systems/install.sh',
'https://status.ghaymah.systems/status/ghaymah',
'https://status.ghaymah.systems/api/status',
'https://logs.ghaymah.systems/logs',
'https://logs.ghaymah.systems/health'
];
for (const u of urls) {
const res = await fetch(u);
console.log(`\nURL: ${u}`);
if (res.error) {
console.log(' Error:', res.error);
} else {
console.log(' Status:', res.status);
console.log(' Body:', res.body ? res.body.substring(0, 300) : '<empty>');
}
}
}
main();