Files
portfolio/app/api/n8n/status/route.ts
denshooter e2c2585468 feat: update Projects component with framer-motion variants and improve animations
refactor: modify layout to use ClientOnly and BackgroundBlobsClient components

fix: correct import statement for ActivityFeed in the main page

fix: enhance sitemap fetching logic with error handling and mock support

refactor: convert BackgroundBlobs to default export for consistency

refactor: simplify ErrorBoundary component and improve error handling UI

chore: update framer-motion to version 12.24.10 in package.json and package-lock.json

test: add minimal Prisma Client mock for testing purposes

feat: create BackgroundBlobsClient for dynamic import of BackgroundBlobs

feat: implement ClientOnly component to handle client-side rendering

feat: add custom error handling components for better user experience
2026-01-08 01:39:17 +01:00

39 lines
1.0 KiB
TypeScript

// app/api/n8n/status/route.ts
import { NextResponse } from "next/server";
// Cache für 30 Sekunden, damit wir n8n nicht zuspammen
export const revalidate = 30;
export async function GET() {
try {
// Rufe den n8n Webhook auf
const res = await fetch(`${process.env.N8N_WEBHOOK_URL}/denshooter-71242/status`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
// Cache-Optionen für Next.js
next: { revalidate: 30 }
});
if (!res.ok) {
throw new Error(`n8n error: ${res.status}`);
}
const data = await res.json();
// n8n gibt oft ein Array zurück: [{...}]. Wir wollen nur das Objekt.
const statusData = Array.isArray(data) ? data[0] : data;
return NextResponse.json(statusData);
} catch (error) {
console.error("Error fetching n8n status:", error);
// Leeres Fallback-Objekt, damit die Seite nicht abstürzt
return NextResponse.json({
status: { text: "offline", color: "gray" },
music: null,
gaming: null,
coding: null
});
}
}