Skip to content

Instantly share code, notes, and snippets.

@csuwildcat
Created March 23, 2023 17:45
Show Gist options
  • Save csuwildcat/12d36a2c6e8f18f56685dc3928aab484 to your computer and use it in GitHub Desktop.
Save csuwildcat/12d36a2c6e8f18f56685dc3928aab484 to your computer and use it in GitHub Desktop.
let result
for (let endpoint of endpoints) {
try {
const url = parseURL(endpoint);
result = await this.#transports[url?.protocol?.slice(0, -1)]?.send(url.href, request);
}
catch(e){
}
};
if (result) return result;
else {
console.error('All service endpoints were unreachable.', error);
return { status: { code: 503, detail: 'Service Unavailable' } };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment