import { NextResponse } from 'next/server'; import { prisma } from '@/lib/db'; export const dynamic = 'force-dynamic'; export async function GET() { try { const routes = await prisma.route.findMany({ orderBy: [ { departureCity: 'asc' }, { arrivalCity: 'asc' }, ], }); return NextResponse.json({ routes }); } catch (error) { console.error('Fetch routes error:', error); return NextResponse.json({ error: 'Failed to fetch routes' }, { status: 500 }); } }