Files
portaldata/app/api/mahasiswa/jenis-beasiswa/route.ts
Randa Firman Putra e028039ee2 First commit
2025-06-18 22:03:32 +07:00

20 lines
475 B
TypeScript

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 }
);
}
}