Where to put node.js code in cPanel

I am entirely new to backend development so this might be a ridiculously easy and straightforward question, but I'm really not sure. I am trying to learn node.js for backend development, and all of the tutorials I have seen so far show how node can be used to run JavaScript from the terminal and create a server on local host. While this is a neat thing to do, I am stuck there and having difficulty understanding where to put my node.js code on cPanel and how to use it effectively along with the rest of my html/css/js code; all the examples I have seen are very isolated and don't have much interaction with these other files.

Again, I don't have any backend experience, so it would not be very helpful to explain this concept relative to another server-side language like Python, Ruby, or PHP, as I really have no idea where I would put any of the code for any of that stuff either or how it fits into the bigger picture. If the answer could maybe touch on how to integrate Python or PHP as well and general patterns for backend development---the easy stuff everyone assumes but no one explains---it would be much appreciated.


It doesn't matter where you put it. However you probably want to keep it in the folder of the username which is using it. I created a folder called app/ in my users folder and put all my crap in there. Then you simply set it up to listen on a port approved by your host.

You can use a .htaccess file in your public_html folder to redirect to the correct port number.

Your node.js will handle routing. So to go to certain css/html files you will have to set that up in your node.js code.

链接地址: http://www.djcxy.com/p/67112.html

上一篇: 在clojure应用程序中放置数据库访问/功能的位置?

下一篇: 在cPanel中把node.js代码放在哪里