Close Database Connection On User Leave #8489
Unanswered
ByteAtATime
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Perhaps a combination of
<script>
import { beforeNavigate } from '$app/navigation';
beforeNavigate(({ type }) => {
if (type === 'leave') {
// close db connection
}
})
</script> https://kit.svelte.dev/docs/modules#$app-navigation-beforenavigate |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I currently use the
pg
node package to connect to the database. Is there a way that I can close this connection on the server side when the user leaves? I’m looking for something likeload()
but for when the page unloads.Beta Was this translation helpful? Give feedback.
All reactions