Async/Await & Express, Mocha etc.
Let's look how we can use Async/Await with common frameworks such as: Express.js, Mocha.js etc. The short of it is that: it's *really* easy. We just need to make sure that callbacks provided to the functions are prefixed with "async" so that we can use await
in the callbacks:
Express.js Examples:
or a more elaborate example:
Mocha Example:
Pretty easy and elegant, isn't it?
Last updated
Was this helpful?