Files
evilspins/server/api/artists.ts
2025-12-31 16:31:53 +01:00

24 lines
459 B
TypeScript

import { eventHandler } from 'h3'
import { getDatabase } from '../utils/database'
export default eventHandler(() => {
const db = getDatabase()
const artists = db
.prepare(
`
SELECT id, name, url, cover_id
FROM artists
ORDER BY id
`
)
.all()
return artists.map((artist: any) => ({
id: artist.id,
name: artist.name,
url: artist.url,
coverId: `https://f4.bcbits.com/img/${artist.cover_id}_4.jpg`
}))
})