xxxxxxxxxx
import { NextRequest, NextResponse } from "next/server";
try{
..
try code
}catch(error){
catch (error) {
//Response given by fetch api where we have to stringify our object
// return new Response(JSON.stringify({ error: "could not fetch group by" }), { status: 500 });
//Here Nexjs simple our work by giving NextResponse
return NextResponse.json({ error: "Could not fetch group by" }, { status: 500 });
}
}