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
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import http from "http";
|
||||
import fetch from "node-fetch";
|
||||
import NodeCache from "node-cache";
|
||||
|
||||
// Use a dynamic import for node-fetch so tests that mock it (via jest.mock) are respected
|
||||
async function getFetch() {
|
||||
try {
|
||||
const mod = await import("node-fetch");
|
||||
// support both CJS and ESM interop
|
||||
return (mod as any).default ?? mod;
|
||||
} catch (err) {
|
||||
return (globalThis as any).fetch;
|
||||
}
|
||||
}
|
||||
|
||||
export const runtime = "nodejs"; // Force Node runtime
|
||||
|
||||
const GHOST_API_URL = process.env.GHOST_API_URL;
|
||||
@@ -36,7 +46,8 @@ export async function GET() {
|
||||
|
||||
try {
|
||||
const agent = new http.Agent({ keepAlive: true });
|
||||
const response = await fetch(
|
||||
const fetchFn = await getFetch();
|
||||
const response = await fetchFn(
|
||||
`${GHOST_API_URL}/ghost/api/content/posts/?key=${GHOST_API_KEY}&limit=all`,
|
||||
{ agent: agent as unknown as undefined }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user