How do I close connection pooling created with the mysql module when the console ctrl+c shuts down express?

I need to do a game background, but I don"t know much about the back-end part, so I"d like to ask the following people.
I created the connection pool with the mysql module, and I see in the document that if you don"t call pool.end () to close the connection pool, the connection will remain until the mysql server shuts down.
looks at express"s documentation and doesn"t seem to have any events when the server shuts down.
so please tell me what I should do to ensure that connection pooling is properly closed when I turn on and off the server?

Mar.11,2021

process.on('exit', (code) => {
   //do what you want
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c4a2-4ef67.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c4a2-4ef67.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?