Use JavaScript's Async/Await with Promises

If promises are like a yield sign, JavaScript’s await function modifier is a stop sign. To write asynchronous code in Node.js in a way that reads like synchronous code, we can use the async/await JavaScript keywords. Sometimes you want a logical flow to wait for something to complete without blocking the Node process, and only then move on to the next line. Async/await are relatively new features, available in Node.js v7.6 and up. The basic idea behind async/await is to write asynchronous code that looks and behaves similarly to synchronous code. Code that will be executed in the order it was written.

In this tutorial you'll learn:

  • What the JavaScript async/await function modifiers do
  • How to use async/await with Promises in Node
  • How to handle errors with async/await

By the end of this tutorial you'll have a better understanding of what the async/await keywords do and how to make use of them to manage the flow of asynchronous 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.