Files
better-auth/docs/app/llms.txt/[...slug]/route.ts
Robi 0c4583c015 docs: add LLM copy button and view options components (#3423)
* feat: add LLM copy button and view options components
- update routing for LLM text generation, adding .mdx to a route now generates its .md repsresentation
- add rewrite from /docs/:path*mdx to /llms.txt/:path so ai can traverse the llms.txt as routes

* chore: lint

* chore: cubic
2025-07-17 01:16:04 -07:00

22 lines
568 B
TypeScript

import { type NextRequest, NextResponse } from "next/server";
import { source } from "@/lib/source";
import { notFound } from "next/navigation";
import { getLLMText } from "@/app/docs/lib/get-llm-text";
export const revalidate = false;
export async function GET(
_req: NextRequest,
{ params }: { params: Promise<{ slug: string[] }> },
) {
const slug = (await params).slug;
const page = source.getPage(slug);
if (!page) notFound();
return new NextResponse(await getLLMText(page));
}
export function generateStaticParams() {
return source.generateParams();
}