0

I am trying to create an all-in-one tool to monitor my different apps. I decided to do it in sveltekit because I am used to using it but only in frontend. This is the first time I use it to do the front and back. So I would like to initialize a connection to a database at the server startup before the front is even served.

I have seen several people who put their initialization in src/hook.server.ts but I do not want to reset the connection with each new request from a user.

How could I do that?

PS: I use sveltekit 2.9.0 and svelte 5.0.0 and I use the node adapter

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.