This video is available to students only

What is Node.js? A Beginner's Guide.

Node is a JavaScript runtime environment that was first introduced in 2009 by Ryan Dahl, as a response to how slow web servers were at the time. In this lesson, we'll introduce Node and talk about the capability Node provides to make I/O tasks asynchronous and non-blocking.

What is Node?

📝 This lesson's quiz can be found - here.
🗒️ Solutions for this lesson's quiz can be found - here.
📖 This lesson's lecture slides can be found - here.

Node

Node is a JavaScript runtime environment that can run on different platforms (Mac, Windows, Linux, etc.). What this means is JavaScript (which was originally created to run inside a web browser) can now be run on any computer as a web server.

Node was originally released in 2009 by Ryan Dahl as a response to how slow web servers were at the time. This is because most web servers would block the I/O (Input/Output) task (e.g. reading from the file system or accessing the network) which will lower throughput. Node changed this model by making all I/O tasks non-blocking and asynchronous. Non-blocking, for example, just means a request from another interaction can be processed without waiting for the prior interaction request to finish. This allowed web servers to serve countless requests concurrently.

Non-blocking I/O

Here's an example taken from the main Node website in comparing code between the synchronous blocking state and the asynchronous non-blocking state.

This example covers the use of the Node File System (fs module) which allows us to work with the file system in our computer.

const fs = require("fs");
const data = fs.readFileSync("/file.md");
moreWork();

Start a new discussion. All notification go to the author.