Roger Siver
3 min readJun 21, 2021

--

nodejs logo

This week in coding Bootcamp I had what is starting to become a familiar experience. Becoming really excited about something, realizing my idea of it was a complete misconception, becoming very frustrated and almost shutting down, all followed by a big aha moment. This Bootcamp, like many, teaches javascript and nodejs. We npm install and start things like a lot of people are used to, we refer to node constantly as we watch it runs applications we love, and we use the node-package-manager (npm) to install our thousands of dependencies per project. /node-modules is such a given in project structure it was easy for a beginner like me to look past what node actually is.

Before nodejs, Javascript only existed to perform client-side operations. A web page would run it and it could be used to connect to servers and manipulate data. The most popular server for this purpose at the time (2009) was Apache. At this point, it’s important to clarify that a server is a process running on a computer, that accepts connections via HTTP, and responds to them accordingly. Apache webserver reigned supreme until Ryan Dahl got tired of his shortcomings and came up with nodeJS. Quickly npm was added to the project and it took off from there.

So my “a-ha” moment this week in coding Bootcamp was finally understanding the difference between npm, nodejs, and javascript itself. I had noticed the very attractive looking “debug” window inside vscode while I was using node to run a simple webpage with no server function at all, merely a client connecting to a server elsewhere. As I struggled to get my console log statements to show up right in vscode I asked my instructor to help troubleshoot. Immediately I was reminded of the difference between client-side and server-side technologies. Nodejs was just hosting a page for me to look at, my code was running on that page and in my browser. In this particular instance, nodejs was still functioning as a web server, responding to an HTTP request for the page to be served to my browser and nothing more. My log statements that I wanted to show up in the node console were being executed by the browser, a separate console, and in the case of production, a totally different machine.

The server works to manage data and respond to the client's requests, like a restaurant. The restaurant has various systems that they use to manage inventory, cook the food, and keep things clean and well managed. A customer’s order gets input into that system, and food gets output with the customer never needing to understand the system that turned their money into their meal. The client and server being totally separate processes, while code for both may live together in a repository seems like it’s probably pretty obvious to everyone other than me, but I hope this helps someone.

--

--