()
| 118 | |
| 119 | // Handle process termination to stop the server gracefully |
| 120 | const shutdown = async () => { |
| 121 | console.log('\nShutting down PGLiteSocketServer...') |
| 122 | await server.stop() |
| 123 | await db.close() |
| 124 | console.log('Server stopped') |
| 125 | process.exit(0) |
| 126 | } |
| 127 | |
| 128 | process.on('SIGINT', shutdown) |
| 129 | process.on('SIGTERM', shutdown) |