This commit is contained in:
Lee
2024-10-16 08:03:36 +01:00
parent 6d6e59ed13
commit 1eed0e1e99
4 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,23 @@
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,
};
}
}