13 lines
293 B
TypeScript
13 lines
293 B
TypeScript
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,
|
|
});
|
|
}
|