feat(web): Last.fm client lib + top-artists/albums + mb release-group routes

This commit is contained in:
Jonathan
2026-07-13 19:01:04 +02:00
parent 5eb4fbfd55
commit ecdad88973
8 changed files with 502 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { searchReleaseGroup } from "@/lib/musicbrainz";
export async function GET(request: Request) {
const url = new URL(request.url);
const artist = url.searchParams.get("artist");
const album = url.searchParams.get("album");
if (!artist || !artist.trim() || !album || !album.trim()) {
return Response.json({ error: "artist and album are required" }, { status: 400 });
}
let match;
try {
match = await searchReleaseGroup(artist.trim(), album.trim());
} catch {
return Response.json({ error: "MusicBrainz unavailable" }, { status: 502 });
}
if (!match) {
return Response.json({ error: "no match" }, { status: 404 });
}
return Response.json(match);
}