A route handler that returns config should be force-static
A GET route that reads files or constants is dynamic by default, so it runs on every request. Mark it static and it becomes a file in the build output.
export const dynamic = "force-static";
export function GET() { return Response.json({ posts: index() }); }Anything that only changes on deploy fits, like a search index, a sitemap fragment or a manifest. If it changes on a schedule instead, pair it with revalidate.
nextjsperformance