As I was beginning to tool around a bit with node, I was told that I needed to undergo a little bit of a paradigm shift since I was coming from a PHP background. I would ask questions like, I have my script working in terminal, now how can I upload it to the server and access through an AJAX request?. I was told that it doesn't work like that and that Node scripts aren't just that magically work like PHP when you upload them to a server. Node IS a server. So I thought to myself, Okay. Let's just put this on the shelf for a while. I basically only use node for scripts that I run locally anyway, so if I have to type node server.js in terminal to use my script, it wasn't that inconvenient, and it allowed me to happily learn it without having to worry about shifting any of my paradigms.Then, last week I made a small front end that worked with some node scripts I was writing and I realized that I needed members of another team to use it. I guessed that they weren't going to have Node installed or be comfortable enough with a CLI to type node server.js. I found out about Heroku. And I uploaded all my scripts to it, and you know what: it magically works! Paradigm shift avoided AGAIN.I feel like continually having avoided this paradigm shift is hurting me. So I need to figure it out. How node can be a server? Yet also node files can be uploaded to something like Heroku (/Docker? Another container I've heard discussed) and work in the same way as I'm used to server-side PHP running? Yet, it seems, at the same time not: I can't upload them to an Apache server I don't think and expect them to work. Also, since I've mentioned Docker, once I understand exactly what Heroku is, is Docker basically the same thing?(I felt this question is correct for this SE site, but please let me know if you think it would be a better fit on SO or somewhere else)
Confusion over Node as a script vs Node as a server
php;javascript;web development;node.js
Node is a javascript execution environment.  Node can act as a server (by executing a script that performs server functions).Heroku is an operating system (sitting in the cloud) that supports (among others) Node scripts. You can think of it like your desktop sitting on the internet, running a Node environment.When you run a server type of script in Heroku, it isn't any different than you running it on one your companies public facing servers.One of the nice things about Heroku over Apache, is that Heroku is designed to allow users to upload applications without an admin being required to deploy it.