0

When I started to learn about backend I thought that node.js would be perfect, it's popular, everyone loves it and the idea of having js both on the front-end and back-end was just great. Unfortunately I ran into some problems: Every crash course I watched ended with showing the http module and eventually hosting the script on heroku. This made me thinking: "Isn't it reinventing the wheel?" - I know there is express but that is different. Back to the time when I was only a front-end developer to host a site I was just using an ftp to upload my HTML, CSS and js files to the server and after that when I visited the domain there were all of them. This conflicts with making a server with node, so my question is am I trying to use node not where I should? I don't even know if putting node scripts on a web hosting like that would work.

To explain better my problem here's an example: Let's say I am making a simple image gallery. I would use a back-end technology to make an image uploading system and to tell the client side js how many images are in the gallery (something would just count files in the image folder) - Is node the right tool for that or should I use other technologies such as PHP?

Heretic Monkey
  • 10,498
  • 6
  • 45
  • 102
Confuze
  • 3
  • 3
  • Express is a npm package; i.e. it's just a utility layer that runs on node. And it's a bit dated. It's like using a math package, it doesn't suddenly make JS's `*` operator obsolete just because some package offers multiplication. Node also has purposes beyond hosting a website. – junvar Apr 06 '21 at 14:28
  • No, you can't simply stick javascript files in a static host and expect it to work as expected. You have to actually run node on the server. – mousetail Apr 06 '21 at 14:35
  • Node provides an environment to run JavaScript on the server. How would you execute JavaScript on the server without it? Of course it's not needed to just serve static files to the client. – Felix Kling Apr 06 '21 at 14:44

0 Answers0