79351216

Date: 2025-01-13 05:13:46
Score: 0.5
Natty:
Report link

Update Jan 2025

@Matthias Mertens pointed me in the right direction in the comments of another answer that hooks.server.ts only runs on the first request in dev mode, but will run at startup in prod. Also, there is now an init() for anyone coming here in 2025

In hooks.server.ts:

import type { ServerInit } from '@sveltejs/kit';
import * as db from '$lib/db';

export const init: ServerInit = async () => {
    await db.connect()
};
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Matthias
Posted by: Matt Fiocca