Tutorial Series
Node.js is a popular open-source runtime environment that can execute JavaScript outside of the browser. The Node runtime is commonly used for back-end web development, leveraging its asynchronous capabilities to create networking applications and web servers. Node also is a popular choice for building command line tools.
In this series, you will go through exercises to learn the basics of how to code in Node.js, gaining powerful tools for back-end and full stack development in the process.
Tutorial
Updated on March 18, 2022
Node.js is a popular open-source runtime environment that can execute JavaScript outside of the browser using the V8 JavaScript engine, which is the same engine used to power the Google Chrome web browser’s JavaScript execution. In this tutorial you’ll create your first program with the Node.js runtime. You’ll be introduced to a few Node-specific concepts and build your way up to create a program that helps users inspect environment variables on their system.
Tutorial
Updated on March 18, 2022
The Node.js Read-Eval-Print-Loop (REPL) is an interactive shell that processes Node.js expressions. The shell reads JavaScript code the user enters, evaluates the result of interpreting the line of code, prints the result to the user, and loops until the user signals to quit. The REPL is bundled with with every Node.js installation and allows you to quickly test and explore JavaScript code within the Node environment without having to store it in a file.
Tutorial
Updated on June 8, 2022
The Node.js Package Manager (npm) is the default and most popular package manager in the Node.js ecosystem, and is primarily used to install and manage external modules in a Node.js project. In this tutorial, you will manage packages with npm, first keeping track of modules with the package.json file, and then using the npm CLI tool to list your package dependencies, update your packages, uninstall your packages, and perform an audit to find security flaws in your packages.
Tutorial
Published on December 3, 2019
In Node.js, a module is a collection of JavaScript functions and objects that can be used by external applications. In this tutorial, you will create a Node.js module organized with npm that suggests what color web developers should use in their designs. You will develop the module by storing the colors as an array, and providing a function to retrieve one randomly. Afterwards, you will run through various ways of exporting and importing a module into a Node.js application.
Tutorial
Published on February 5, 2020
With asynchronous programming, JavaScript and Node.js developers can execute other code while waiting for activities like network requests to finish. This can make writing API calls much more efficient. In this tutorial, you will learn how JavaScript manages asynchronous tasks with help from the Event Loop. You will then create a program that uses asynchronous programming written in three ways: with callbacks, promises, and the async/await keywords.
Tutorial
Published on March 17, 2020
Testing is an integral part of software development. With the right test setup, this process can be automated, saving a lot of time. In this article, you’ll write tests for a Node.js TODO list module. You will set up and use the Mocha test framework to structure a series of integration tests. Then you’ll use the Node.js assert module to create the tests themselves. Finally, you will try out testing with asynchronous code, and use hooks to prepare your test fixtures and environments.
Tutorial
Published on April 10, 2020
Node.js allows developers to use JavaScript to write back-end code, even though traditionally it was used in the browser to write front-end code. Having both the frontend and backend together like this reduces the effort it takes to make a web server. In this tutorial, you will learn how to build web servers using the http module that’s included in Node.js. You will build web servers that can return JSON data, CSV files, and HTML web pages.
Tutorial
Published on May 1, 2020
A buffer is a space in memory (typically RAM) that stores binary data. In Node.js, we can access these spaces of memory with the built-in Buffer class. Buffers are useful when using JavaScript to interacting with binary data, usually at lower networking levels. In this tutorial, you will use the Node.js REPL to create buffers, read from buffers, write to and copy from buffers, and use buffers to convert between binary data and data encoded with ASCII and UTF-8.
Tutorial
Published on May 29, 2020
Event emitters are objects in Node.js that trigger an event by sending a message to signal that an action was completed. In this article, you will create an event listener for a TicketManager JavaScript class that allows a user to buy tickets. You will set up listeners for the buy event, which will trigger every time a ticket is bought. This process will also teach you how to manage erroneous events from the emitter and how to manage event subscribers.
Tutorial
Published on June 24, 2020
In this article, you will use a debugger to debug some sample Node.js applications. You will first debug code using the built-in Node.js debugger tool, setting up watchers and breakpoints so you can find the root cause of a bug. You will then use Google Chrome DevTools as a Graphical User Interface (GUI) alternative to the command line Node.js debugger.
Tutorial
Published on July 31, 2020
Since Node.js instances create a single process with a single thread, JavaScript operations that take a long time to run can sometimes block the execution of other code. A key strategy to work around this problem is to launch a child process to run multiple processes concurrently. In this tutorial, you will use the child_process module to create child processes while executing a series of sample Node.js applications.
Tutorial
Published on September 9, 2020
With Node.js, you can use JavaScript to programmatically manipulate files with the built-in fs module. The name is short for “file system,” and the module contains all the functions you need to read, write, and delete files on the local machine. In this article, you will use the asynchronous fs module to read a file with fs.readFile(), create and write to a new file with fs.writeFile(), delete the file with fs.unlink(), and move the first file with fs.rename().
Tutorial
Published on October 7, 2020
It’s common for a modern JavaScript application to communicate with other servers to accomplish a task. In this article, you will use the https Node.js module to make HTTP requests to a web API, including GET, POST, PUT, and DELETE requests.
Book
Published on December 14, 2020
Download the Complete eBook! How To Code in Node.js eBook in EPUB format How To Code in Node.js eBook in PDF format Node.js is a…
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.