It’s time to get to know… Node.js
Tags: Beginner, Nodejs

A Beginners Guide to What the Heck Node.js Actually Does.

Photo by Michael Browning on Unsplash

You may have heard that a new developer’s journey usually begins with learning front end development and then gradually evolves into backend. But what does that even mean? My favorite explanation of the difference between front end and backend development is the restaurant metaphor. When you dine in a nice restaurant, you will walk into a beautiful room and be seated. Once seated a waiter/waitress will come over and take your order. So far this experience is equivalent you opening up google and entering what you are looking for into the search bar. Once your order is placed, the waitress brings your order back to the kitchen where the real magic happens. The food is cooked and the nice bottle of wine is gathered from the cellar. This is the backend. The waitress will then bring you your food and drink then VOILA! You now have a wonderful experience. Once you hit enter in the google search bar, your request is sent off to the server where your search results are prepared just like your ribeye.

Now that you get the gist, let’s get a little deeper. A major step in the full-stack development direction for anyone noob learning javaScript is working with and understanding Node.js. This is the natural choice for developers as it allows full-stack development using just one language, javaScript. Some of the big boys that use Node.js that depend on Node.js are ebay, trello, twitter, uber, and netflix.

Soooo… What is node?

18 year old software developer, Jamie Corkhill, explains it best:

Node is only an environment, or runtime, within which to run normal JavaScript (with minor differences) outside of the browser. We can use it to build desktop applications (with frameworks like Electron), write web or app servers, and more.

Created in 2009, node.js provides a way for developers to write javaScript on the server when it was previously only able to be written in the web browser. As Dr. Angela Yu puts it, “Before Node.js, javaScript code could only interact with the browser, request information from the browser, and add event listeners to components with the use of the browser, but developers were never able to go beyond the boundaries of the browser into the users computer and use there file system or networking processes.” The reasoning behind this exclusion is for security reasons and to protect users from malicious code. However, with Node.js, developers can safely build a desktop application that can get access to a users file system and write code that can work directly with the computer, independent of the browser.

Photo by Ian Battaglia on Unsplash

Another powerful use of Node.js is that it can run on a personal computer OR you can get javaScript to run on a server! Thinking back to the restaurant metaphor, this is similar to the chef doing all the prep work and cooking while you sit and enjoy your martini. Node.js allows javaScript code to be executed on the SERVER instead of on the client computer. Allowing for significantly faster runtimes.

According to John Elder, the founder of Codemy.com, Node.js uses a non=blocking I/O model and is asynchronous, meaning it operates on single thread that allows it support 10,000s concurrent connections that are held in an event loop. This is used for Restful APIs to accept Get request & Post request. That is all pretty technical but to sum it all up, it makes things fast and efficient. benefactors of all this advanced speed are chat apps, games, blogs, social applications, or anything that is not cpu intensive.

Photo by Charles Deluvio on Unsplash

I hope this helped you get a general understanding of what Node.js is and does and it sparks your interest to dive deeper into back-end development. Here is Andy Corkhill great link that dives deep into Node.js.

*https://www.smashingmagazine.com/2019/02/node-api-http-es6-javascript/