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)
?
glyph.