mirror of
https://github.com/ihatenodejs/aidxnCC.git
synced 2025-04-25 14:05:58 +00:00
21 lines
619 B
TypeScript
21 lines
619 B
TypeScript
import { NextResponse } from 'next/server'
|
|
|
|
export async function GET() {
|
|
try {
|
|
const response = await fetch("https://api.listenbrainz.org/1/user/p0ntus/playing-now", {
|
|
headers: {
|
|
Authorization: `Token ${process.env.LISTENBRAINZ_TOKEN}`,
|
|
},
|
|
})
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! Status: ${response.status}`)
|
|
}
|
|
|
|
const data = await response.json()
|
|
return NextResponse.json(data)
|
|
} catch (error) {
|
|
console.error('Error fetching now playing:', error)
|
|
return NextResponse.json({ error: 'Failed to fetch now playing data' }, { status: 500 })
|
|
}
|
|
}
|