diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-06-29 19:55:51 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-06-29 22:06:39 -0700 |
| commit | eda5691cfcb3be0bb6ccf1b2ad4fa92801ad86c4 (patch) | |
| tree | ee83300ec2d7fc2763ba6b7887d61c2af0208c7a /backend/src/config | |
| parent | 1b66788e84c1d2eef875534cd02685b56d08547f (diff) | |
seperate routes and middleware into seperate files
Diffstat (limited to 'backend/src/config')
| -rw-r--r-- | backend/src/config/db.ts | 17 |
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); +}); |
