You can execute everything inside a promise like with Koa, which amounts to something like:
http.createServer((req, res) => {
handle(req)
.then((response) => res.send(response))
.catch(() => res.send(500))
})
Where `handle` is an async function and thus all your application logic is in async/await space.Ie. Be okay if a syntax error crashes your server.
I came to this after building C#, Scala, and Java webapps, so it surprised me that this these class of coding errors could take down a site (both screwing up the try/catch or not handling promises).
There is probably some room for Node/the language/Express to make the experience better, either way it's something you'd need to know if you're new to the platform :)
In a Java app you except all the way to the request response.
In a Go app you return all the way to the request response.
In a Node app, you have to call your way back to the request response. Or you don't, potentially leaving the whole process in an inconsistent state. The amazing concurrency of node comes at a price.
They're soft-deprecated in Node now though, and AFAICT work on a replacement has stalled.