First commit
This commit is contained in:
20
app/api/mahasiswa/jenis-beasiswa/route.ts
Normal file
20
app/api/mahasiswa/jenis-beasiswa/route.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import pool from '@/lib/db';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const [rows] = await pool.query(`
|
||||
SELECT DISTINCT jenis_beasiswa
|
||||
FROM beasiswa_mahasiswa
|
||||
ORDER BY jenis_beasiswa ASC
|
||||
`);
|
||||
|
||||
return NextResponse.json(rows);
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Internal Server Error' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user