10 lines
318 B
TypeScript
10 lines
318 B
TypeScript
export function jsonResponse(data: unknown, status = 200): Response {
|
|
return new Response(JSON.stringify(data), {
|
|
status,
|
|
headers: { 'Content-Type': 'application/json' },
|
|
});
|
|
}
|
|
|
|
export function errorResponse(message: string, status: number): Response {
|
|
return jsonResponse({ error: message }, status);
|
|
}
|