feat: Add database connection handling to server hooks

This commit is contained in:
2024-08-28 00:13:46 +09:00
parent e7949b6c5f
commit d3cc3145e0
8 changed files with 109 additions and 87 deletions
+10
View File
@@ -0,0 +1,10 @@
import type { Handle } from '@sveltejs/kit'
import { getConnection } from '$lib/server/database/get_connection'
export const handle: Handle = async ({ event, resolve }) => {
const pg = getConnection();
event.locals.db = pg;
const result = await resolve(event);
return result;
}