trackerdeq/src/app/api/lobby/[player]/route.ts

20 lines
446 B
TypeScript

import { getLobbyData } from "@/app/lib/utils";
import { NextRequest } from "next/server";
export async function GET (
req: NextRequest,
context: { params: { player: string } }
)
{
try
{
const { player } = context.params;
const data = await getLobbyData( player );
return Response.json( data );
} catch ( err: any )
{
console.error( "API error:", err );
return new Response( "Failed to fetch lobby data", { status: 500 } );
}
}