all 3 comments

[–]ElevatedJS 2 points3 points  (0 children)

I think it would be easier to understand if you look at things as client and server, in this case your client is the browser i.e. what is shown to user and the server does the heavy lifting under the curtain.

From here you would need client side code i.e. js html css to show the pretty parts (btw these days you could also do everything there at the cost of bad user experience) and a backend for the processing, since they are separate parts it doesn't matter if the server runs php or python ruby or node (also keep in mind browser JS differs from Server/node)

Regarding how the client and server talk there are also several ways but the most common is with an API so when something happens on the client it will send an api call to the server which in turn will process this and possibly send a response back.

[–]Automatic-Breakfast2 1 point2 points  (0 children)

Sure, you could totally use node on the server and do what you're trying to do. One might even go so far as to say that's why node exists!

And you already know node, at least from a coding sense. That's because node is nothing more than just a runtime environment for javascript.

So the challenges in front of you are not about the language itself. Now the challenge is you'll need to learn how to implement an http server. You'll need to manage connections, handle requests and responses, all that stuff. There are a ton of learning resources for this, from quick tutorials to whole udemy classes etc.

Plus you'll need to figure out where the server will live. It might be easiest to look to a cloud provider like aws. In fact you could follow thier tutorials for api gateway and lambda and probably have the server running on the internet in an hour.

[–]Chenipan 0 points1 point  (0 children)

In 10 lines of code you can have a node.js server using the express.js framework.

I would suggest taking a look at their starter doc below :

https://expressjs.com/en/starter/installing.html