Execute code before "refresh" command?

I’m new to node, express, and databases, but I want to save my data to a database everytime my project "refresh"es, on editing a document, but I can’t get it to trigger. This code:
process.on('exit', function(code) { console.log(About to exit with code ${code}); });
doesn’t execute unless I call process.exit() myself. Is it something with how the “refresh” command works?
Any advice would be greatly appreciated

Legend has it, refresh sends a SIGTERM signal to the process. Gracefully shutdown Bot when App refreshes on changes

1 Like

Thanks a ton, this works perfectly! I’m having a bit of an issue as now it says my app is taking too long to stop, but thank you nonetheless!