Simple pattern for refactoring existing promises to async/await

This is my first story to Medium, I guess.

I work with Javascript in the NodeJS backend a lot. Currently I’m revising my old code that’s full of promises and thought about how to make it look simpler with less then()-s and code levels etc. I came to a very simple pattern that I use for refactoring promises to async/await.

This short video shows how to change current method that uses promises to the same method using async/await. It helps to make code more readable with less nesting and get rid of some lines of code. Less is more!