diff --git a/server/api/chatbot-taff.post.ts b/server/api/chatbot-taff.post.ts index 87a6e93..23a0838 100644 --- a/server/api/chatbot-taff.post.ts +++ b/server/api/chatbot-taff.post.ts @@ -5,7 +5,7 @@ */ import { readFileSync } from 'node:fs' -import { resolve } from 'node:path' +import { fileURLToPath } from 'node:url' import { checkRateLimitJson } from '~/server/utils/rateLimitJson' interface PlateformeMinimal { @@ -70,8 +70,8 @@ export default defineEventHandler(async (event) => { // Lire le JSON statique des plateformes let plateformes: PlateformeMinimal[] = [] try { - const jsonPath = resolve(process.cwd(), 'public/data/plateformes-taff.json') - const raw = JSON.parse(readFileSync(jsonPath, 'utf8')) + const jsonUrl = new URL('../../public/data/plateformes-taff.json', import.meta.url) + const raw = JSON.parse(readFileSync(fileURLToPath(jsonUrl), 'utf8')) plateformes = (raw.plateformes ?? []).map((p: any) => ({ id: p.id, nom: p.nom,