An unhandled exception in a Node application can crash the whole process, taking your site offline completely. Even if you try to trap the error in a
try/catch block, it can still find a way to die. The best way to handle this is to, as Erlanger’s like to say, let it crash and restart it.
In this video Burke Holland will show you how Azure restarts a dead Node application using Docker container orchestration. There’s a cheaper way to do that, however. Azure uses PM2 to run Node applications, which means you can tweak the restart rules and even create multiple Node processes in a cluster!
You can read more about the Azure resources in this video here: