mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-08-15 21:48:05 +00:00
Forex Dashboard v8.0
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const filePath = join(process.cwd(), "data", "rate_expectations.json");
|
||||
const raw = readFileSync(filePath, "utf-8");
|
||||
const data = JSON.parse(raw);
|
||||
// Return the most recent snapshot (first item)
|
||||
const latest = Array.isArray(data) ? data[0] : data;
|
||||
return NextResponse.json(latest);
|
||||
} catch {
|
||||
return NextResponse.json({ error: "rate_expectations.json not found. Run the scraper first." }, { status: 404 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user