Game: öffentliche Song-Liste für GuessInput statt geschütztem /api/songs

This commit is contained in:
Hördle Bot
2025-12-03 14:06:32 +01:00
parent d6ad01b00e
commit 2cb9af8d2b
2 changed files with 40 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
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);
}