How to run Node.JS server for a web application?

后端 未结 4 733
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 15:18

Info: I am very new to node.JS!

I have written a sample server that can listen to http requests on port XXXX. When I run this server from commandline (Windows) it se

4条回答
  •  悲&欢浪女
    2020-12-07 15:47

    On Windows you have two options of hosting node.js applications:

    1. Self-host the node.exe process just like you would on *nix. During development you will probably just start it from the command line. In production you want to come up with a mechanism that will provide process lifetime management around node.exe (e.g. start it when the OS starts). The most reasonable way of doing it on Windows is to use Windows Services (also known as NT Services). A component that can help you do this is http://nssm.cc/.
    2. Host node.js with the IIS using iisnode (http://github.com/tjanczuk/iisnode). Compared to self-hosting this method has a number of benefits outlined in https://github.com/tjanczuk/iisnode/wiki. But you also want to explore the performance implications (not all of them bad actually): http://tomasz.janczuk.org/2012/06/performance-of-hosting-nodejs.html.

提交回复
热议问题