I usually doesn't share this information but you can easily install the npm package along with the pm2.
The pm2 can automatically restart any process under its chain, therefore all you have to do is create a talkaction to shutdown the server. When the process is closed the pm2 automatically opens it again.
love you <3To restart the server you will need external help. You just shut it down and let the tool restart it.
[LINUX] Auto server restart AND database backup (https://otland.net/threads/linux-auto-server-restart-and-database-backup.253373/)
For windows the attached file (you start the server with it instead of the .exe, throw it in server folder and edit at notepad).