core/adapters/search.adapter.ts
core/adapters/search.adapter.ts is a file in Bane's Lab Deploy. 16 lines of code and 6 definitions.
import type { SearchPing } from "#types/deployment.types";
const CONTENT_TYPE = "Content-Type";
const JSON_TYPE = "application/json; charset=utf-8";
const METHOD = "POST";
export const readLive = async function readLive(url: string): Promise<string | null> {
const response = await fetch(url);
return response.ok ? response.text() : null;
};
export const postPing = async function postPing(endpoint: string, ping: SearchPing): Promise<number> {
const response = await fetch(endpoint, {
body: JSON.stringify(ping),
headers: { [CONTENT_TYPE]: JSON_TYPE },
method: METHOD,
});
return response.status;
};