1

I have a Node.js application that I require to run on Windows Server. For the development process, we execute the app simply through command-line or PowerShell using the standard command:

node index.js

What is the best practice and most performant way of running this application on Windows permanently? Or is running it through CMD or PowerShell as we already doing the best way? If so, is either PS or CMD better?

Running as a service is a no-brainer, but the question still remains even if the application is 'servicified', as launching a Node app as a service still requires the specification of a shell through which to execute, such as PowerShell or CMD. Is there another shell we should use? Or is there a way to not use a shell at all?

Please advise as it surprisingly doesn't seem like there's any standardized advice anywhere on the internet; which begs the question also: is simply no one out there running production Node.js apps on Windows perhaps..?

Craig
  • 11
  • 2
  • Seems like you can use either [IIS](https://stackoverflow.com/questions/46266609/host-node-js-on-windows-server-iis) if you really need it, or just as [a service](https://stackoverflow.com/questions/10547974/how-to-install-node-js-as-windows-service) which have even more easy to use package. Consult with your sysadmin about which approaches are preferable, because they have different security and routing implication. – Martheen Nov 07 '22 at 05:12

1 Answers1

0

I suggest using a package such as pm2. PM2 runs your process in the background. Meaning that you can exit your terminal, and your app will continue to run. Only way to turn it off is: 1: Shutting down your server 2: pm2 stop ProcessName

stop-ts
  • 13
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 09 '22 at 20:26