diff --git a/functions/common.ts b/functions/common.ts new file mode 100644 index 0000000..03d89d0 --- /dev/null +++ b/functions/common.ts @@ -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, + }); +}