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