In Express.js, is there someway of setting a callback function to be executed when the application shuts down?
There is process.on('exit', callback):
process.on('exit', function () { console.log('About to exit.'); });