This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
Files
scoresaber-reloadedv3/projects/common/src/utils/api-utils.ts

24 lines
346 B
TypeScript
Raw Normal View History

2024-10-16 08:03:36 +01:00
import ky from "ky";
type ApiHealth = {
online: boolean;
};
/**
* Gets the health of the api server.
*
* @param url the url of the api
*/
export async function getApiHealth(url: string): Promise<ApiHealth> {
try {
await ky.get(url);
return {
online: true,
};
} catch {
return {
online: false,
};
}
}