Fix PizzINT routes with explicit endpoint files

- Replace catch-all route with explicit files
- api/pizzint/dashboard-data.js for /api/pizzint/dashboard-data
- api/pizzint/gdelt/batch.js for /api/pizzint/gdelt/batch
- Improve rss-proxy error handling with more details
This commit is contained in:
Elie Habib
2026-01-11 10:21:13 +04:00
parent fc59f087de
commit 6a073c392c
5 changed files with 116 additions and 73 deletions

View File

@@ -96,8 +96,13 @@ export default async function handler(req) {
});
} catch (error) {
const isTimeout = error.name === 'AbortError';
return new Response(JSON.stringify({ error: isTimeout ? 'Feed timeout' : 'Failed to fetch feed' }), {
status: isTimeout ? 504 : 500,
console.error('RSS proxy error:', feedUrl, error.message);
return new Response(JSON.stringify({
error: isTimeout ? 'Feed timeout' : 'Failed to fetch feed',
details: error.message,
url: feedUrl
}), {
status: isTimeout ? 504 : 502,
headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' },
});
}