Asynchronous JavaScript Examples
Evolution of different async approaches from pure Callback Hell (server.js) to async / await
(server-micro.js)
-
server.js - callback approach, no functions, just callback hell
-
server-flatten.js - callback approach, named functions, more organized
-
server-after.js - callback approach, use external modules for workflow (
after
)
-
server-async.js - callback approach, use
async.js
for workflows
-
server-async-flatten.js - callback approach, use
async.js
for workflows, separation of concerns (more organized and maintainable)
-
server-promise.js - native promise approach, wrap async functions with
new Promise
-
server-promisify.js - native promise approach, use
promisify
modules to implement Promise based APIs
-
server-co.js - native promise approach with
co
and generators
-
server-micro.js - async/await with
micro
framework