generated from gitea_admin/default
front end
This commit is contained in:
24
server/api/__strapi__/[collection].get.js
Normal file
24
server/api/__strapi__/[collection].get.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
})
|
||||
Reference in New Issue
Block a user