Deploy as service with PM2
                                            PM2 is a daemon process manager that will help you manage and keep your application online. Getting started with PM2 is straightforward, it is offered as a simple and intuitive CLI, installable via NPM.
First, install pm2 CLI globally using:
Copy
                                                
                                            
                                            npm install pm2@latest -g
                                                Then simply run the server using:
Copy
                                                
                                            
                                            pm2 start dist/main.js
                                                To stop the server execute
Copy
                                                
                                            
                                            pm2 kill
                                                See the PM2 documentation for more commands.