24 lines
459 B
TypeScript
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`
|
|
}))
|
|
})
|