import { TimelineReader } from '$lib/server/timeline'; import type { HandleServerError } from '@sveltejs/kit'; import fs from 'fs/promises'; TimelineReader.init(); export const handleError = (({ error }) => { if (error instanceof Error) { console.error('Something went wrong: ', error.name, error.message); } return { message: `Something went wrong! ${error}` }; }) satisfies HandleServerError; import type { Handle } from '@sveltejs/kit'; export const handle = (async ({ event, resolve }) => { // Reeder *insists* on checking /feed instead of /feed.xml if (event.url.pathname === '/feed') { return new Response('', { status: 301, headers: { Location: '/feed.xml' } }); } if (event.url.pathname === '/feed.xml') { const f = await fs.readFile('feed.xml', { encoding: 'utf8' }); return new Response(f, { headers: [['Content-Type', 'application/atom+xml']] }); } const response = await resolve(event); return response; }) satisfies Handle;