17 lines
480 B
TypeScript
17 lines
480 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { CarRepository } from '../../../../backend/repositories/CarRepository';
|
|
|
|
const carRepository = new CarRepository();
|
|
|
|
export async function GET() {
|
|
try {
|
|
const brands = await carRepository.getAllBrands();
|
|
return NextResponse.json(brands);
|
|
} catch (error) {
|
|
console.error('Error fetching brands:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch brands' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|