A lot has been written already about the transition from callbacks
to promises and now to the new
async/await feature in ES7.
"The purpose of `async/await` functions is to simplify the behavior of using promises synchronously and to perform some behavior on a group of `Promises`.
Just as `Promises` are similar to structured callbacks, `async/await` is similar to combining generators and promises."[^1]
In this blog post I present what this code “upgrade” meant for CRUD operations
performed on dev bookmarks. I use Moongoose in an ExpressJS/NodeJS backend
to perform the operations against a MongoDB database.
In a later refactoring the database access part has been decoupled from ExpressJS and moved to separate service functions.
Thanks to unified error handling the database errors are now handled centrally.
Source code for codever.land is available on Github -