Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Access Asynchronous Data in an Express API with async/await


    This lesson will rely on the built-in support for async functions found in Express 5 to demonstrate how an API can easily work with data asynchronously. By the end of the lesson our API will have the ability to save its notes to disk as they're added and read them when the server starts up again.

    First we'll update our Note model to persist data to the filesystem using the MapStore class created in a previous lesson. Then we'll access those updated methods on the Note model using the await keyword in our routes. We'll also briefly discuss the importance of catching errors that come from promises and async functions.