feat: adding teams in PG
This commit is contained in:
21
app/api/teams/direction/[direction]/route.ts
Normal file
21
app/api/teams/direction/[direction]/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { TeamsService } from "@/services";
|
||||
|
||||
interface RouteParams {
|
||||
params: {
|
||||
direction: string;
|
||||
};
|
||||
}
|
||||
|
||||
export async function GET(request: Request, { params }: RouteParams) {
|
||||
try {
|
||||
const teams = await TeamsService.getTeamsByDirection(params.direction);
|
||||
return NextResponse.json(teams);
|
||||
} catch (error) {
|
||||
console.error("Error loading teams by direction:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to load teams by direction" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user