/** * @type {import("@sveltejs/kit").RequestHandler} */ export async function get(req) { const allPostFiles = import.meta.glob('../posts/**/*.md'); const allPosts = await Promise.all( Object.entries(allPostFiles).map(async ([path, resolver]) => { const { metadata } = await resolver(); let postPath = path.slice(2, -3); if(postPath.endsWith('/index')) postPath = postPath.slice(0, -6); return { ...metadata, path: postPath, }; }) ); allPosts.sort((a, b) => { return new Date(b.date) - new Date(a.date) }); return { body: ` Blog - Daniel Bulant My personal blog about work, programming and fun stuff. https://danbulant.eu/posts 2022 Daniel Bulant ${new Date().toUTCString()} 180 ${allPosts.map(t => ` ${t.title} ${t.description} https://danbulant.eu${t.path} ${new Date(t.date).toUTCString()} ${t.path} `).join("\n")} ` }; }