Node.jsAsync/Await


Introduction

Async/await is a set of keywords that allows writing of asynchronous code in a procedural manner without having to rely on callbacks (callback hell) or promise-chaining (.then().then().then()).

This works by using the await keyword to suspend the state of an async function, until the resolution of a promise, and using the async keyword to declare such async functions, which return a promise.

Async/await is available from node.js 8 by default or 7 using the flag --harmony-async-await.