Access Asynchronous Data in an Express API with async/await

Share this video with your friends

Send Tweet

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.

Resources

~ 3 years ago

you did set the three function that use await to async but then after few second async is gone from the code ...