14 lines
407 B
TypeScript
14 lines
407 B
TypeScript
import { fetchAllLocations } from '@/app/lib/actions/locationActions';
|
|
import { NextResponse } from 'next/server';
|
|
|
|
export const GET = async (
|
|
req: Request,
|
|
) => {
|
|
// get year from query params
|
|
const url = new URL(req.url as string);
|
|
const year = parseInt(url.searchParams.get('year') as string, 10);
|
|
const locations = await fetchAllLocations(year);
|
|
|
|
return NextResponse.json({ locations });
|
|
}
|