Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create very-often used methods
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 77f5b2d commit 47e639b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 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,
});
}

0 comments on commit 47e639b

Please sign in to comment.