feat: Add database connection handling to server hooks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user