Article

Node js: An Intro for Beginners

Robert Bunch

Written By Robert Bunch

Last updated on September 19, 2017

Course Report strives to create the most trust-worthy content about coding bootcamps. Read more about Course Report’s Editorial Policy and How We Make Money.

node-js-introduction-guide-for-beginners

You may have heard developers talk about Node or Node.js when discussing full-stack JavaScript. But what is Node and should you learn it? We asked DigitalCrafts Lead Instructor, Rob Bunch, to give us an in-depth overview of Node (with beginners in mind)! Rob looks at the origins of Node and how it works with JavaScript, what Node can be useful for, the advantages and disadvantages of learning Node, and why DigitalCrafts teaches Node. At the end of the article, find out how to get started learning Node.js for free. You’ll learn:

What are the origins of Node.js?

For the last 10 to 15 years, programming languages have fought for dominance. There's C, PHP, Ruby, Python, Go, R, and so on. You could ask 10 developers what they used and get 10 different answers. The one exception to this is JavaScript. Anyone who has developed for the web has no choice but to use JavaScript because it's the only language the browser understands and JSON is the primary means of passing data around the Internet. JavaScript has become the lone ubiquitous language amidst all the back-end languages. This is the dichotomy of back-end vs. front-end; back-end had always been off limits to JavaScript because it lives in the browser, meanwhile, there are zounds of back-end languages, none of which are an option for the browser. So in the past, front-end devs had to learn one of any number of nasty server languages to make the jump, and back-end devs had to learn JavaScript (if they don’t know it already).

In September of 2008, Google launched their V8 engine for Chrome. It took JavaScript and compiled it down to machine code before running it rather than having the browser interpret it on the fly. This meant that suddenly JavaScript became 1. crazy-fast, and 2. machine code (even though it’s still running in the browser), the same as all the other backend languages.

This presented an opportunity to Ryan Dahl, the creator of Node. What if you could bridge the gap? What if you could take the language that everyone knows and make it work outside of the browser with this new V8 machine?

 

What is Node?

It's a JavaScript runtime; which means it is a way to run JavaScript outside of the browser. Now, it's not the JavaScript that front-end developers are used to because there is no longer a browser to work with. But, all the core parts of JavaScript remain: arrays, objects, loops, conditionals, asynchronous architecture, etc. This means, if you can write JavaScript in the browser, you just need to cross the bridge of letting go of the browser and you can write code for anything. Just like PHP, ASP, and so on.

It’s important to note that Node is not actually JavaScript. It’s C. It reads JavaScript (born out of Google’s V8 engine designed for the Chrome browser). Because it’s written in C, it has access to the bowels of your operating system, something that browser JavaScript by itself cannot have. It’s also not a web server. It doesn’t have config files like Apache or NGINX. It can easily function as one, but Node.js is just another way to execute code on your computer. Node is a program that you feed JavaScript. That's it. The big win here is that you don't have to learn C, or about sockets or network protocols, or reach into the dungeons of Linux to write ultra powerful things... you can use JavaScript because Node runs JS.

 

What are the advantages of learning Node?

So you can run JavaScript outside of the browser thanks to this new tool, but when is Node actually better than a traditional back-end language? It’s not the perfect language, but it has some huge perks:

  • Once you’ve learned JavaScript, you don’t have to learn a new language to use Node, and can use it across the entire stack.
  • You can write JavaScript from beginning to end and even accept JSON natively, unlike all other languages.
  • It works particularly well anytime you have a lot of requests coming in because JavaScript is asynchronous.
    • If you don’t know what asynchronous is, simply put, it means that JavaScript can handle things out of order and a lot of the Internet is happening that way. It’s like going to Walmart on Black Friday and instead of having either one really long line that’s slow (ugh), or many, many lines that have to be staffed, you can have one line that can check everyone out at once. This is excellent for websites (as a web server).
  • It’s incredibly fast when it comes to handling traffic, and it has the largest module market of any language. NPM (node package manager) has grown at a meteoric rate and there are multiple modules of just about everything.

 

What are some examples of what Node is used for?

  • Walmart switched their website over to Node specifically for all the requests that happen on Black Friday. It’s also great for API’s and real-time applications (like instant messaging or games).
  • At a former job, we had a Node developer processing pictures that came in from a real-time camera and sent them on to another server. That I know of, the pictures never saw the web.
  • Many companies I interact with don’t use Node as their primary language, but do use it to manage dependencies because the NPM (node package manager) market is so vast and solid.

These are just a few examples, but it’s not really limited in its application, certainly not to the web. It’s a general-purpose language that can do pretty much anything any other language can do.

 

What are alternatives to Node?

Node is now competing with PHP, Python, and all the other back-end languages. They can work together if organized correctly, but it’s really a matter of choice.

ASP and PHP are particularly effective web languages because the learning curve is next to nothing for a beginner.

 

What are the disadvantages of Node?

  • Writing a web server in Node requires quite a bit of knowledge.
  • It’s quite a young technology compared to most entry-level languages which means there aren’t as many starter resources because they just haven’t been developed yet.
  • JavaScript’s greatest strength is the fact that it’s asynchronous, but this is also a primary complaint.
    • Confusion, callback hysteria, and frustration are common because JavaScript doesn’t run from left to right and top to bottom.
  • You will need to embrace promises if you are going to have a chance – something no other languages have to worry about.
  • Node is not ideal in CPU-heavy apps, like looking for oil on a supercomputer. It can be done with Node, it’s just not ideal, and has found its primary place elsewhere.

 

Why does DigitalCrafts teach Node?

We chose to teach JavaScript at DigitalCrafts for many of the positives listed above, plus:

  • It allows us to never leave JavaScript, with just a slight pivot when it comes time to teach back-end.
  • The job market has a crazy demand for it since so many modern applications have high input/output requirements.

I don’t think JavaScript is the best “first” language for a beginner (DigitalCrafts teaches Python for the first two weeks of its bootcamp), but I think it’s a cinch learning anything after JavaScript because all its nuances make other languages seem fairly simple. It’s very common for our graduates to get jobs in other languages, and this has held true. We make everything from an instant message client, to a voting app, to several APIs, even a full-blown e-commerce site.

 

How do I learn Node.js?

Follow the free 4-part tutorial by DigitalCrafts below:

  1. http://www.digitalcrafts.com/blog/getting-started-nodejs-part-1
  2. http://www.digitalcrafts.com/blog/getting-started-nodejs-part-2
  3. http://www.digitalcrafts.com/blog/getting-started-nodejs-part-3
  4. http://www.digitalcrafts.com/blog/getting-started-nodejs-part-4

Find out more and read DigitalCrafts reviews on Course Report. Check out the DigitalCrafts website.

About The Author

Robert Bunch

Robert Bunch

Robert Bunch is the Lead Full Stack Immersive Instructor at DigitalCrafts in Atlanta. Before joining DigitalCrafts Rob worked as a web developer for 11 years at companies like Turner Broadcasting, Two Rivers Marketing, and WebFilings.

Also on Course Report

Get Free Bootcamp Advice

Sign up for our newsletter and receive our free guide to paying for a bootcamp.

By submitting this form, you agree to receive email marketing from Course Report.

Get Matched in Minutes

Just tell us who you are and what you’re searching for, we’ll handle the rest.

Match Me