25 lines
734 B
TypeScript
25 lines
734 B
TypeScript
import { NextResponse } from "next/server";
|
|
|
|
const DEPLOYER_URL = process.env.DEPLOYER_URL || "http://127.0.0.1:3010";
|
|
const DEPLOYER_TOKEN = process.env.DEPLOYER_TOKEN || "";
|
|
|
|
export async function GET() {
|
|
try {
|
|
const headers: Record<string, string> = {
|
|
"Content-Type": "application/json",
|
|
};
|
|
if (DEPLOYER_TOKEN) headers["X-API-Token"] = DEPLOYER_TOKEN;
|
|
const res = await fetch(`${DEPLOYER_URL}/api/stats`, {
|
|
headers,
|
|
cache: "no-store",
|
|
});
|
|
const data = await res.json();
|
|
return NextResponse.json(data, { status: res.status });
|
|
} catch (e) {
|
|
return NextResponse.json(
|
|
{ error: e instanceof Error ? e.message : "Error al obtener stats" },
|
|
{ status: 502 }
|
|
);
|
|
}
|
|
}
|