Node.js
Node.js is a JavaScript framework that makes it possible to use JavaScript for backend development.
Node.js is a JavaScript framework that makes it possible to use JavaScript for backend development.
Once upon a time we told you that there are frontend and backend languages and that JavaScript was a frontend programming language that does all of its work in the browser, right?
Well today we have a new thing to tell you: in the world of the web, things are always cha-cha-changing.
Everything we taught you before is still true, it’s just that now, thanks to Node.js it’s also possible to use JavaScript for backend development.
So why would you want to use JavaScript on the frontend and the backend?
A few reasons. First, simplicity. Why program in two languages when one will do? Second, and more importantly, Node.js is specially designed to make it easy to build data-heavy web applications that will scale well and can work in real-time.
What this means is that web applications built in Node.js are easy to build, can use lots of data (like Facebook), can update in real-time (like Twitter), and can handle lots of users at once. So, when you are featured in a Techcrunch write-up, your Node.js web app won’t crash because it has a special way to handle server requests that make huge traffic spikes no big deal!
So, if you want your web application to do all that, and if you want to use JavaScript for your front and backend code, Node.js is your solution.
Cocktail Party Fact
Thought we were done telling you about all the cool things Node.js can do? Wrong!
Turns out that Node.js is also really great for building web servers, which means making a computer ready to serve as a web server. Why is it so good? Because unlike other web servers, Node.js uses an event-driven model for handling server requests (also called asynchronous input output process or asynchronous I/O), instead of a thread-driven model (also called synchronous I/O or blocking I/O).
The way that Node.js-ers explain what an event-driven model is, is by using the metaphor of a fast food restaurant. If a fast food restaurant used a thread-driven model you would walk up to the counter, place your order with the server, and then wait at the cash register until your food is ready and no one else would be able to order until you had the hamburger in-hand.
Not so efficient, right?
Fortunately, most fast food restaurants use an event-driven model where you go to the register, place your order, pay, and then step aside while you wait for your food so that the next person can order.
As does Node.js!