Understanding Promises in Node.js

A Node.js Promise is a placeholder for a value that will be available in the future, allowing us to handle the result of an asynchronous task once it has completed or encountered an error. Promises make writing asynchronous code easier. They’re an improvement on the callback pattern and very popular in Node.js. Introduced as a standard part of JavaScript with ES6, Promises are used in ES8 async functions as building blocks.

Promises are used for control flow, and to handle errors when executing asynchronous code. Knowing how to work with Promises is an important part of modern JavaScript.

In this tutorial we'll:

  • Start to understand what Promises are in Node.js
  • Learn how to create and work with Promises, and why they’re used in standard modern Web APIs

By the end of this tutorial you should be able explain what a Promise is, and when you might want to use them in your code.

Log in or Sign up to view the complete tutorial.

Sign in with your Osio Labs account
to gain instant access to our entire library.