import { fetchBlogroll } from "@utils/data/blogroll.js"; import { fetchGlobals } from '@utils/data/globals.js'; export async function GET() { try { const blogroll = await fetchBlogroll(); const globals = await fetchGlobals(); const dateCreated = new Date().toUTCString(); const opmlContent = ` OPML for all feeds in ${globals.site_name}'s blogroll ${dateCreated} ${blogroll .map( (blog) => ` ` ) .join("\n")} `.trim(); return new Response(opmlContent, { status: 200, headers: { "Content-Type": "application/xml", }, }); } catch (error) { console.error("Error generating blogroll OPML:", error); return new Response("Error generating blogroll OPML", { status: 500 }); } }