22 lines
525 B
TypeScript
22 lines
525 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
// Öffentliche, schreibgeschützte Song-Liste für das Spiel (GuessInput etc.).
|
|
// Kein Auth, nur Lesen der nötigsten Felder.
|
|
export async function GET() {
|
|
const songs = await prisma.song.findMany({
|
|
orderBy: { createdAt: 'desc' },
|
|
select: {
|
|
id: true,
|
|
title: true,
|
|
artist: true,
|
|
},
|
|
});
|
|
|
|
return NextResponse.json(songs);
|
|
}
|
|
|
|
|