mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-05-13 18:46:21 +02:00
- 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>
25 lines
805 B
JavaScript
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 });
|
|
}
|
|
}
|