Files
worldmonitor/api/fred-data.js
Elie Habib dbdbde84c7 Simplify Vercel API proxies to single-file endpoints
- cloudflare-outages.js - Cloudflare Radar API
- faa-status.js - FAA NASSTATUS
- fred-data.js - FRED economic data
- gdelt-geo.js - GDELT protest data
- nga-warnings.js - NGA maritime warnings

Updated frontend services to use new endpoints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:47:30 +04:00

25 lines
805 B
JavaScript

export const config = { runtime: 'edge' };
export default async function handler(req) {
const url = new URL(req.url);
const id = url.searchParams.get('id');
const cosd = url.searchParams.get('cosd');
const coed = url.searchParams.get('coed');
if (!id) {
return new Response('Missing id parameter', { status: 400 });
}
try {
const fredUrl = `https://fred.stlouisfed.org/graph/fredgraph.csv?id=${id}${cosd ? `&cosd=${cosd}` : ''}${coed ? `&coed=${coed}` : ''}`;
const response = await fetch(fredUrl);
const data = await response.text();
return new Response(data, {
status: response.status,
headers: { 'Content-Type': 'text/csv', 'Access-Control-Allow-Origin': '*' },
});
} catch (error) {
return new Response(error.message, { status: 500 });
}
}