mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
14 lines
297 B
TypeScript
14 lines
297 B
TypeScript
export const jsonResponse = (data: object, status = 200) => {
|
|
return new Response(JSON.stringify(data), {
|
|
headers: {
|
|
"Content-Type": "application/json"
|
|
},
|
|
status,
|
|
});
|
|
}
|
|
|
|
export const errorResponse = (error: string, status = 500) => {
|
|
return jsonResponse({
|
|
error: error
|
|
}, status);
|
|
} |