import { createError, getRouterParam } from "h3" import { createStrapiProxyHandler } from "~~/server/utils/strapiEndpoint" const COLLECTION_MAP = { artistes: "/api/artistes-ondifs", artistesinvitees: "/api/artistes-invites", concerts: "/api/concerts", missions: "/api/mission", mission: "/api/mission", } export default defineEventHandler(async (event) => { const collection = getRouterParam(event, "collection") const strapiPath = COLLECTION_MAP[collection] if (!strapiPath) { throw createError({ statusCode: 404, statusMessage: "Unknown Strapi collection", }) } return createStrapiProxyHandler({ strapiPath })(event) })