// ======================================================================= // src/routes/+page.server.ts (확장자 변경 및 타입 추가) // ======================================================================= import pool from '$lib/server/database'; import type { PageServerLoad } from './$types'; export const load: PageServerLoad = async () => { try { const result = await pool.query<{ IndexMovie: number }>( 'SELECT DISTINCT "IndexMovie" FROM public."TumerDatasetRef" ORDER BY "IndexMovie" ASC' ); return { movies: result.rows.map(row => row.IndexMovie) }; } catch (error) { console.error("Failed to load initial movies", error); return { movies: [], error: "데이터베이스에서 영화 목록을 가져오는 데 실패했습니다." }; } };