I'm creating an API that is using koa and babel async/await
Every promise in my controllers function looks like this:
async function ... {
await Promise ...
.then(data => response function)
.catch(err => err function)
}
Each promise has the exact same response and error function.
Is there a way for me to automatically have each promise resolve with the same then/catch (like a default resolve function for the promise).
Then my code would look like this:
async function ... {
await Promise ...
}
and the promise would auto resolve/catch.