Files
Eurovision-25-frontend/server/api/artist.get.ts
T
2025-05-04 22:42:44 +03:00

18 lines
480 B
TypeScript

import { getQuery } from 'h3';
export default defineEventHandler(async (event) => {
const query = getQuery(event)
const { id } = query as { id: number }
const config = useRuntimeConfig(event)
const apiBase = config.public.apiBase
const response = await $fetch(`${apiBase}/songs/${id}`)
if (!response) {
throw createError({
statusCode: 404,
statusMessage: 'Artist not found'
})
}
return response
})