Create very-often used methods

This commit is contained in:
2023-10-19 16:50:48 -04:00
parent 77f5b2db26
commit 47e639be43

12
functions/common.ts Normal file
View File

@ -0,0 +1,12 @@
export function jsonError(error: string, status: number) {
return jsonResponse(JSON.stringify({ error }), status);
}
export function jsonResponse(body: string, status = 200) {
return new Response(body, {
headers: {
"content-type": "application/json",
},
status,
});
}