diff options
Diffstat (limited to 'backend/src/config/db.ts')
| -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); +}); |
