mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-08-07 01:37:45 +00:00
67c1811c8f
- preferredRegion: fra1/lhr1/cdg1 to bypass US cloud IP blocks on rateprobability.com - Better sec-* headers to pass bot detection (same-origin cors mode) - cache: no-store on fetch to avoid stale null caching - Log CB count on each invocation for diagnostics Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
853 B
TypeScript
24 lines
853 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { fetchAllCBPaths } from "@/lib/rateprobability";
|
|
import type { RateProbData } from "@/lib/rateprobability";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
export const preferredRegion = ["fra1", "lhr1", "cdg1"]; // Europe (Frankfurt / London / Paris)
|
|
|
|
export type { RateProbData, CBRatePath, RateProbMeeting } from "@/lib/rateprobability";
|
|
|
|
export interface RateProbabilitiesResponse {
|
|
data: RateProbData;
|
|
fetchedAt: string;
|
|
}
|
|
|
|
export async function GET() {
|
|
const data = await fetchAllCBPaths();
|
|
const currencies = Object.keys(data);
|
|
console.log(`[rate-prob] fetched ${currencies.length} CBs: ${currencies.join(", ")}`);
|
|
return NextResponse.json(
|
|
{ data, fetchedAt: new Date().toISOString() } satisfies RateProbabilitiesResponse,
|
|
{ headers: { "Cache-Control": "no-store" } }
|
|
);
|
|
}
|