aboutsummaryrefslogtreecommitdiffstats
path: root/backend/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'backend/src/config')
-rw-r--r--backend/src/config/db.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/backend/src/config/db.ts b/backend/src/config/db.ts
new file mode 100644
index 0000000..024a7ed
--- /dev/null
+++ b/backend/src/config/db.ts
@@ -0,0 +1,17 @@
+import { PrismaClient } from '@prisma/client';
+
+export const prisma = new PrismaClient();
+
+process.on('beforeExit', async () => {
+ await prisma.$disconnect();
+});
+
+process.on('SIGINT', async () => {
+ await prisma.$disconnect();
+ process.exit(0);
+});
+
+process.on('SIGTERM', async () => {
+ await prisma.$disconnect();
+ process.exit(0);
+});
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage