import type { APIRoute } from "astro";
import { config } from "../../config";
import { getSortedDocs } from "../content-utils";

const docs = await getSortedDocs();

export const GET: APIRoute = async () => {
    return new Response(
        `# ${config.SITE_NAME} Full Documentation\n\n${docs
            .map((doc) => {
                return `${doc.body}\n\n`;
            })
            .join("")}`,
        { headers: { "Content-Type": "text/plain; charset=utf-8" } }
    );
};