Initial commit

This commit is contained in:
Jarek Krochmalski
2025-12-28 21:16:03 +01:00
commit 62e3c6439e
552 changed files with 104858 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { json, text } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
export const GET: RequestHandler = async ({ url }) => {
try {
const licensePath = join(process.cwd(), 'LICENSE.txt');
const content = readFileSync(licensePath, 'utf-8');
// Return as plain text if requested
if (url.searchParams.get('format') === 'text') {
return text(content);
}
return json({ content });
} catch (error) {
console.error('Failed to read LICENSE.txt:', error);
return json({ error: 'License file not found' }, { status: 404 });
}
};