Init
This commit is contained in:
18
app/api/people/route.ts
Normal file
18
app/api/people/route.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { parseCSV } from '@/lib/csv-parser';
|
||||
import { join } from 'path';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const filePath = join(process.cwd(), 'group-dev-ad.csv');
|
||||
const people = await parseCSV(filePath);
|
||||
return NextResponse.json(people);
|
||||
} catch (error) {
|
||||
console.error('Error parsing CSV:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to parse CSV file' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user