Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Server Side development with Node.js and Koa.js Quick Start Guide

You're reading from   Server Side development with Node.js and Koa.js Quick Start Guide Build robust and scalable web applications with modern JavaScript techniques

Arrow left icon
Product type Paperback
Published in Nov 2018
Publisher Packt
ISBN-13 9781789345391
Length 132 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Olayinka Omole Olayinka Omole
Author Profile Icon Olayinka Omole
Olayinka Omole
Arrow right icon
View More author details
Toc

What is async... await?

Asynchronous functions are functions that work asynchronously. They return a Promise class implicitly and can run concurrently. We will be discussing two major ways to define asynchronous functions. These include the following:

  • Using the native Promise class
  • Using the modern Async keyword

The await keyword is used inside an asynchronous function to resolve a promise. Async and await are usually used together for managing the control of flow in a modern asynchronous JavaScript application. Koa relies heavily on async.. await to avoid callback hell and provide a more convenient method for handling errors.

The promise class

Before introducing async, let's discuss a little about the native Promise...

You have been reading a chapter from
Server Side development with Node.js and Koa.js Quick Start Guide
Published in: Nov 2018
Publisher: Packt
ISBN-13: 9781789345391
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime