import { useContentSource } from '../../lib/content-source'

export default defineEventHandler(async (event) => {
  const id = decodeURIComponent(getRouterParam(event, 'id') ?? '')
  const project = await useContentSource().getProject(id)
  if (!project) {
    throw createError({ statusCode: 404, statusMessage: 'Projet introuvable' })
  }
  return project
})
