api.ts
1import { NextResponse } from 'next/server'
2
3/**
4 * Creates a JSON response with a status code.
5 * @param data The data to be returned in the response
6 * @param status The status code of the response (default: 200)
7 * @returns A NextResponse with JSON data and status code
8 */
9export function JsonResponse(data: object | string[], status: number = 200) {
10 return NextResponse.json(data, { status })
11}
12