init
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { prisma } from '@/lib/db';
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user